index.php?mod=x&scr=y&evt=z&id=n =>/php/x/y/z

Discuss practical ways rearrange URLs using mod_rewrite.

index.php?mod=x&scr=y&evt=z&id=n =>/php/x/y/z

Postby hqtrung » Tue Apr 05, 2005 4:49 am

Please some one help me with this mod_rewrite :

- if url contain /php/ then using mod_rewrite
- Convert
index.php?mod=x&scr=y&evt=z&id=n =>/php/x/y/z/index-n.html

This is for mod_rewrite.
PLease give me the regular expression for this replace before output with my script.
Thanks a bunch.
hqtrung
 
Posts: 3
Joined: Thu Mar 17, 2005 4:20 am

Postby hqtrung » Fri Apr 15, 2005 4:52 am

anybody help, please
hqtrung
 
Posts: 3
Joined: Thu Mar 17, 2005 4:20 am

Postby HM » Mon Apr 18, 2005 2:19 pm

Code: Select all
RewriteCond %{DOCUMENT_ROOT}/$4.php -f
RewriteRule ^/?php/([0-9]+)/([0-9]+)/([0-9]+)/([^/\-]+)-([0-9]+).html$ /$4.php?mod=$1&scr=$2&evt=$3&id=$5 [L,NC]
HM
 

Postby hqtrung » Tue Apr 19, 2005 1:25 am

I couldn't make it work.

my script can be access from www.mydomain.com/site/index.php

where can I put the .htaccess file and do I have to do absolute path ?
Thanks
hqtrung
 
Posts: 3
Joined: Thu Mar 17, 2005 4:20 am

Postby HM » Fri Apr 22, 2005 2:13 pm

Yes sorry for taking a few days to respond.
You would need to put this in .htaccess in the 'site' directory.

Obviously you need to include this before the two lines i mentioned
RewriteEngine On
HM
 


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 24 guests

cron