Stop data retention! Click here & act! Are you a webmaster and want to participate? Here you can find all necessary material for your website - Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:
Chris Karakas Online Forum Index Karakas Online
 FAQFAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
How to catch all URLs for module: URL rewriting in PHP-Nuke


Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic
   Chris Karakas Online Forum Index -> PHP-Nuke Forum RSS Feed of this Forum
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea  View previous topic :: View next topic  
Author Message
Steve
Warrant Officer
Warrant Officer


Joined: 01 Oct 2003
Posts: 73

PostPosted: Sat Mar 06, 2004 11:24 pm    Post subject:
Reply with quote

I've already read the section on google tap, and many other resources, but cannot find a mention of spaces anywhere. Sad

I did try and put a space in, although I escaped it as I thought it might have caused probs as the space is also used to seperate the 2 URLs.

I will try just putting a space in and also try with a % and see what happens.

Steve

[EDIT] Just tried it with the space and remembered I have tried it. Putting a space into the .htaccess file where stated causes an Internal Server Error and the site goes down. Putting a space in the stated place in header.php causes errors on those lines.

[EDIT2] The same happens with the % sign.

I think the only option is to replace the space with an underscore before it's converted to a friendly URL by header.php. Possibly have it replaced and output it to another variable ($query2) and then use this in the URL linking to the protections database mod. Then put some code in the search function i put into the protections db mod to take out the space (or spaces).

I have the ideas, but I dunno how to implement them Sad
Back to top
View user's profile Send private message
Steve
Warrant Officer
Warrant Officer


Joined: 01 Oct 2003
Posts: 73

PostPosted: Sun Mar 07, 2004 1:03 am    Post subject:
Reply with quote

Well, i've decided not to bother with anything hard. We don't need to have the rewriting in effect in the search module. So I found a way to stop it from happening on the search module for the link to the protections db.

Instead of having:
Code:
$mod4 = "<li> <a href=\"modules.php?name=Protections_Database&
op=search&query=$query\">Protections Database</a> ($pcnt "._SEARCHRESULTS.")";
I now have
Code:
$mod4 = "<li> <a href=\"http://www.makeabackup.com/modules.php?
name=Protections_Database&op=search&query=$query\">
Protections Database</a> ($pcnt "._SEARCHRESULTS.")";


I figured putting the full URL into the link would stop it from being picked up by the rewrite code in header.php and I figured right.

The link works fine too. So no probs now. Cool

Thanks for your help.

Steve
Back to top
View user's profile Send private message
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6262
Location: Outer Space

PostPosted: Sun Mar 07, 2004 7:58 am    Post subject:
Reply with quote

Finally, someone who really follows the KISS principle! Laughing

PS. In case someone wants to use mod_rewrite with IIS, here is the solution: mod_rewrite with IIS.
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Steve
Warrant Officer
Warrant Officer


Joined: 01 Oct 2003
Posts: 73

PostPosted: Sun Mar 07, 2004 12:14 pm    Post subject:
Reply with quote

The KISS principal? Confused
Back to top
View user's profile Send private message
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6262
Location: Outer Space

PostPosted: Sun Mar 07, 2004 2:43 pm    Post subject:
Reply with quote

Keep It Simple and Stupid! Laughing
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Steve
Warrant Officer
Warrant Officer


Joined: 01 Oct 2003
Posts: 73

PostPosted: Sun Mar 07, 2004 4:24 pm    Post subject:
Reply with quote

Ahh
Back to top
View user's profile Send private message
Steve
Warrant Officer
Warrant Officer


Joined: 01 Oct 2003
Posts: 73

PostPosted: Wed Mar 10, 2004 7:51 pm    Post subject:
Reply with quote

Am having another problem with another rewrite.

I am trying to get the RE
Code:
"'(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&lid=([0-9]*)&ttitle=([a-zA-Z0-9_-]*)'",
to also take the % sign but I am stuck. i know the SMGL and Unicode for it
Code:
& percnt ; and & # x0025 ;
but am having trouble putting it in. i have already tried
Code:
"'(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&lid=([0-9]*)&ttitle=([a-zA-Z0-9_-& # x0025 ;]*)'",
but with no luck.

Had to put spaces into the SMGL and unicode as it didn't want to display it here.

Any ideas on this one? The reason I need it is because 2 of the downloads have % in the name.

Steve
Back to top
View user's profile Send private message
Steve
Warrant Officer
Warrant Officer


Joined: 01 Oct 2003
Posts: 73

PostPosted: Thu Mar 11, 2004 2:38 am    Post subject:
Reply with quote

Well, I've been working on this for several hours now. I figured out that I could take a KISS approach and do a seperate rewrite for every download that had a %. Then I found out that there's an entire section that has backslashes and brackets in the URLs.

I have managed now to get the header.php file to rewrite the these URLs into friendly ones.

Wana know how?

Well, you're gona find out anyway - I've just done it for one link (the details on each file). I edited index.php in the downloads module so that all links like the first one were changed to the second one:
Code:
<a href=\"modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\">

<a href=modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle&1>

I then used this line to catch the URL
Code:
"'(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&lid=([0-9]*)&ttitle=(.*)&1'",

N.B. I found just puting in (.*) knocked the .html part of the rewrite off and it was echoed at the bottom of the table. I figured the RE was reading more than I wanted it to. Puting in something which is static at the end gives it an ending (as such).

This is then rewriten to
Code:
"downdetails\\1-\\2-1.html",
It wont work without the -1 (or something else) on the end.


My problem now is that i have updated the .htaccess file to read
Code:
RewriteRule ^downdetails([0-9]*)-(.*)-1.html modules.php?name=Downloads&d_op=viewdownloaddetails&lid=$1&ttitle=$2&1
but this throws up an error
Code:
Client sent malformed Host header
This happens on any URL with % in it, I guess it happens with brackets and backslashes too.

Does anyone know how to write the code in .htaccess to get around this problem?

I have checked the google tap files and they would get stuck where I was stuck before.

Thanks In Advance

Steve
Back to top
View user's profile Send private message
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6262
Location: Outer Space

PostPosted: Mon Mar 15, 2004 11:10 am    Post subject:
Reply with quote

Steve wrote:
Open quoteAm having another problem with another rewrite.

I am trying to get the RE
Code:
"'(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&lid=([0-9]*)&ttitle=([a-zA-Z0-9_-]*)'",
to also take the % sign but I am stuck. i know the SMGL and Unicode for it
Code:
& percnt ; and & # x0025 ;
but am having trouble putting it in. i have already tried
Code:
"'(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&lid=([0-9]*)&ttitle=([a-zA-Z0-9_-& # x0025 ;]*)'",
but with no luck. Close quote


Did you try

Code:

"'(?<!/)modules.php\?name=Downloads&d_op=viewdownloaddetails&lid=([0-9]*)&ttitle=([a-zA-Z0-9_-%]*)'"


Note that [a-zA-Z0-9_-%] is a so-called "character class". It means a small letter (a-z), a big letter (A-Z), a number (0-9), an underscore, a dash or a percent sign. The star after it means "zero or more occurences of the previous character". Since the "previous character" is one of the above, the whole thing means "zero or more occurences of alphanumeric characters, underscores, dashes, or percent signs" - and should work.

Your URLs have percent signs probably because they contain blanks (which, correctly written, are transformed to "%20" before the URL is sent by your browser to the server). You might avoid the whole problem if you transformed blanks to underscores in your URLs.

Also, take a look at the mod_rewrite RewriteRule generator, play a little around with it and tell me if it helps (I'm not sure about this).
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Steve
Warrant Officer
Warrant Officer


Joined: 01 Oct 2003
Posts: 73

PostPosted: Mon Mar 15, 2004 7:12 pm    Post subject:
Reply with quote

I tried it with the % signs and got an error, see earlier post. Sad I'll give the generator a try.

I know quite a lot about mod_rewrite now, so i understand what most of it means. Cool

I decided to take the KISS pproach again, and just left out those two URLs. The percent sign isn't because of any spaces, it's because the name of 2 of the files has the percent sign in it: Alcohol_120% and Alcohol_52%. I've already asked the guy in charge if he'll drop the percent sign but he's saying NO as it is part of the name.

His loss.

Thanks for helping again.
Very Happy
Steve
Back to top
View user's profile Send private message
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea 
Display posts from previous:   
Post new topic   Reply to topic
   Chris Karakas Online Forum Index -> PHP-Nuke Forum
Page 2 of 3
This page contains valid HTML 4.01 Transitional - click here to check it!
This page contains a valid CSS - click here to check it!

 

Jump to:  
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, 2005 phpBB Group