append phrase to end of url

New to mod_rewrite? This is a good place to start.

append phrase to end of url

Postby adn45 » Wed Oct 21, 2009 1:09 pm

basically, I want to add "language=en" to the end of any url that contains "en/"

for instance, I to rewrite this url:
http://localhost/staging/en/by-manufacturer-en.html
to this url:
http://localhost/zurage/8/en/by-manufac ... anguage=en

Here's what I came up with but it doesn't work:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*en/.*)$ $1?language=en [L]

Thanks in advance.
adn45
 
Posts: 4
Joined: Wed Oct 21, 2009 4:50 am

Postby richardk » Thu Oct 22, 2009 10:21 am

for instance, I to rewrite this url:
/staging/en/by-manufacturer-en.html
to this url:
/zurage/8/en/by-manufacturer-en.html?language=en

Those two URLs are different (ignoring the ?language=en).

Here's what I came up with but it doesn't work:

What happens? Should the URL change?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.*/)?en/(.*)$ /$1$2?language=en [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 10 guests

cron