Struggling with mod rewrite.

Discuss practical ways rearrange URLs using mod_rewrite.

Postby richardk » Tue Oct 21, 2008 9:50 am

Replace
Code: Select all
[QSA,L]

with
Code: Select all
[QSA,E=MR:true,L]


And then try
Code: Select all
if(isset($_SERVER['REDIRECT_MR']) && isset($_GET['lang']) && !empty($_GET['lang']))

Also, clear your browser's cache before trying it.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby 7007 » Wed Oct 22, 2008 1:04 am

Sadly, still not working.
I wonder if you can suggest me to do it trough .htaccess - as all the URL's on the site pointing to domain.com/eng/home/ and the address bar still reads domain.com/index.php?lang=eng&page=home - very confusing to the eye.

Thanks again for your time and patience,

Sasha
7007
 
Posts: 8
Joined: Fri Oct 17, 2008 10:05 am

Postby 7007 » Wed Oct 22, 2008 4:32 am

7007 wrote:Sadly, still not working.
I wonder if you can suggest me to do it trough .htaccess - as all the URL's on the site pointing to domain.com/eng/home/ and the address bar still reads domain.com/index.php?lang=eng&page=home - very confusing to the eye.

Thanks again for your time and patience,

Sasha


It is working now finally!

Those are the "rules" used:
Code: Select all
Options +FollowSymLinks

RewriteEngine On
RewriteRule ^.+(/images/.+)$ $1 [L]
RewriteRule ^.+(/css/.+)$ $1 [L]
RewriteRule ^.+(/js/.+)$ $1 [L]
RewriteRule ([^/]+)/([^/]+)/$ /index.php?lang=$1&page=$2 [QSA,L]

(Very close to the first suggestion.)

for URLs to be
Code: Select all
http://www.domain.com/lang/page/


Had to use <base /> tag (in addition to rules) for folder paths inclusion too and to remove the PHP header re-directives.

Thanks again and again for your time and patience, as I read this forum boards - I see everyone get an answers. So keep up the great work you're doing here.
Thanks,

Sasha
7007
 
Posts: 8
Joined: Fri Oct 17, 2008 10:05 am

Postby richardk » Wed Oct 22, 2008 7:35 am

Code: Select all
RewriteRule ^.+(/images/.+)$ $1 [L]
RewriteRule ^.+(/css/.+)$ $1 [L]
RewriteRule ^.+(/js/.+)$ $1 [L]

can be one rule
Code: Select all
RewriteRule ^.+(/(css|images|js)/.+)$ $1 [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Previous

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: Google [Bot] and 28 guests

cron