Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
whatever72
Newbie
Newbie



Joined: Oct 31, 2012
Posts: 4

PostPosted: Wed Oct 31, 2012 11:19 am Reply with quote

Hi there,
can you help me tap this links

Code:

modules.php?name=Quran&op=search
modules.php?name=Quran&op=search&s=1&query=
modules.php?name=Quran&op=viewayat&surano=1&page=1
modules.php?name=Quran&op=viewayat&surano=1
modules.php?name=Quran


thanks
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Nov 03, 2012 3:16 pm Reply with quote

whatever72,

I am a little concerned about the tapping of the search/query line as character sets other than ISO-8859-1 are not really my strong suit. I am also not a big believer in tapping search type query strings as that can get really messy. Any chance the module developer can change that part of the module to use POST instead of GET for the search feature?

The rest of it is very straightforward and I would encourage you to review the many examples of tapping links and give it a try yourself. It is best, IMO, to learn by doing. Gives you a much stronger foundation as a web administrator.

Of course, if you run into difficulties, do not hesitate to post back with specific issues/questions.

_________________
To err is human, but when the eraser wears out ahead of the pencil, youre overdoing it.
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
whatever72
Newbie
Newbie



Joined: Oct 31, 2012
Posts: 4

PostPosted: Sun Nov 04, 2012 5:59 am Reply with quote

You are right,
thats the problem im facing,

Code:

modules.php?name=Quran&op=search&s=1&query=


output im getting is this

Code:


quran-search.html?s=10&query=%D8%A7%D9%84%D9%84%DB%81



rest working ok.

Code:

$urlin = array(
   '"(?<!/)modules.php\?name=Quran&amp;op=viewayat&amp;surano=([0-9]*)&amp;page=([0-9]*)"',
   '"(?<!/)modules.php\?name=Quran&amp;op=viewayat&amp;surano=([0-9]*)"',
   '"(?<!/)modules.php\?name=Quran&amp;op=search"',
   '"(?<!/)modules.php\?name=Quran&amp;op=search&amp;s=([0-9]*)&amp;query=([a-zA-Z0-9]*)"',
   '"(?<!/)modules.php\?name=Quran"'
);

$urlout = array(
   'quran-surano-\\1-page-\\2.html',
   'quran-sura-\\1.html',
   'quran-search.html',
   'quran-search-\\1-\\2.html',
   'quran.html'
);

RewriteRule ^quran-surano-([0-9]*)-page-([0-9]*).html modules.php?name=Quran&op=viewayat&surano=$1&page=$2 [L]
RewriteRule ^quran-sura-([0-9]*).html modules.php?name=Quran&op=viewayat&surano=$1 [L]
RewriteRule ^quran-search-([0-9]*)-([a-zA-Z0-9]*).html modules.php?name=Quran&op=search&s=$1&query=$2 [L]
RewriteRule ^quran-search.html modules.php?name=Quran&op=search [L]
RewriteRule ^quran.html modules.php?name=Quran [L]

 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sun Nov 04, 2012 11:09 am Reply with quote

You have done an excellent job with these! Way to go. Thank you also for posting that one example because it looks as though the query string is encoded, which is helpful.

To get the search tap to work, you have to move up in the list the longer tap and move the shorter taps below. "Long" vs. "short" is my way of just overly simplifying things. The main point to remember is that the taps are processed in sequence (left-to-right in the array), therefore, your shorter op=search tap took precedence over the longer one.

I made the order switch, plus adjusted the query= tap slightly. See if this works:

Code:

$urlin = array(
   '"(?<!/)modules.php\?name=Quran&amp;op=viewayat&amp;surano=([0-9]*)&amp;page=([0-9]*)"',
   '"(?<!/)modules.php\?name=Quran&amp;op=viewayat&amp;surano=([0-9]*)"',
   '"(?<!/)modules.php\?name=Quran&amp;op=search&amp;s=([0-9]*)&amp;query=([a-zA-Z0-9%]*)"',
   '"(?<!/)modules.php\?name=Quran&amp;op=search"',
   '"(?<!/)modules.php\?name=Quran"'
);

$urlout = array(
   'quran-surano-\\1-page-\\2.html',
   'quran-sura-\\1.html',
   'quran-search-\\1-\\2.html',
   'quran-search.html',
   'quran.html'
);

RewriteRule ^quran-surano-([0-9]*)-page-([0-9]*).html modules.php?name=Quran&op=viewayat&surano=$1&page=$2 [L]
RewriteRule ^quran-sura-([0-9]*).html modules.php?name=Quran&op=viewayat&surano=$1 [L]
RewriteRule ^quran-search-([0-9]*)-([a-zA-Z0-9%]*).html modules.php?name=Quran&op=search&s=$1&query=$2 [L]
RewriteRule ^quran-search.html modules.php?name=Quran&op=search [L]
RewriteRule ^quran.html modules.php?name=Quran [L]


Hopefully that works better for you.
 
View user's profile Send private message Visit poster's website
whatever72
Newbie
Newbie



Joined: Oct 31, 2012
Posts: 4

PostPosted: Sun Nov 04, 2012 3:35 pm Reply with quote

Thanks a lot for your help,
tap is working ok,
Code:

quran-search-10-%D8%A7%D9%86%DA%A9%DB%8C.html


But when i click this link i get

Code:

Internet Explorer
http 404 not found

Firefox
Not found
quran-search-10-انکی.html was not found on this server.


dont know what wrong.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Mon Nov 05, 2012 12:20 am Reply with quote

It is because of the character set not being what I mentioned in my first reply. Unfortunately, as I said then, this is not my strong suit. I don't really support ShortLinks in character sets that are not Latin based.

It is one of the reasons why I also mentioned that it might be best not to tap the search links or possibly checking with the module author to change the search form to using POST instead of GET. I suggest starting there first for now by just removing the two taps with "search" in them.

I was just hoping that maybe the way it was encoded would help. Sorry. Sad
 
View user's profile Send private message Visit poster's website
whatever72
Newbie
Newbie



Joined: Oct 31, 2012
Posts: 4

PostPosted: Mon Nov 05, 2012 9:53 am Reply with quote

Thanks montego for all your help,
found this while searching,
Quote:

sebastiaan at netomzet dot nl05-Mar-2007 01:04

quote: "Apache's mod_rewrite and mod_proxy are unable to handle urlencoded URLs properly - http://issues.apache.org/bugzilla/show_bug.cgi?id=34602"

The most simple solution is to use urlencode twice!

echo urlencode(urlencode($var));

Apache's mod_rewrite will handle it like a normal string using urlencode once.


and guess what i replaced urlencode twice and it worked.
now the link is like this
Code:

quran-search-10-%25D8%25A8%25DA%25BE%25D9%2584%25D8%25A7%25D8%25A6%25DB%258C.html

thank you again.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Mon Nov 05, 2012 11:12 pm Reply with quote

Hey, that is fantastic news! Thank you for sharing that back here.

_________________
To err is human, but when the eraser wears out ahead of the pencil, youre overdoing it.
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunch