I am hoping someone can point me in the right direction. I am making a CMS and I want it to have URL rewrite SE friendly urls. The native urls are in the form:
- Code: Select all
http://www.mysite.com/index.php?language=english&page=index.html
in this case I want the url rewritten to:
- Code: Select all
http://www.mysite.com/english/index.html
But:
I only want it to do it if there is no real file and I want it to rewrite to
- Code: Select all
http://www.mysite.comlish/index.html
I also want it to redirect from some old urls.
I have so far done this:
- Code: Select all
Redirect 301 /printabout.htm http://www.mysite.com/
Redirect 301 /printassembly.htm http://www.mysite.com/assembly.htm
Redirect 301 /printcontact.htm http://www.mysite.com/contact.htm
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*[^/]+/(.*)\.htm\ HTTP/
RewriteRule (.*)/(.*) index.php?language=$1&page=$2 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)\.htm\ HTTP/
RewriteRule (.*\.htm*) index.php?page=$1 [L]
It works but I am not sure if it should as I tried it on another server and it did not work. The [L] flag does not seem to work properly as what happens after has an effect where it shouldn't.
I want it to go something like:
If pattern is http://www.mysite.com/???/???.html translate to
http://www.mysite.com/index.php?languag ... e=???.html and STOP.
Elseif pattern is http://www.mysite.com/???.html translate to http://www.mysite.com/index.php?page=???.html
Also the redirects do wierd things. I tried adding a [L] to the redirects and it broke. I just want them to redirect and do nothing else.
If anyone can shed some light on this that would be great as I am a bit stumped by this.
Thanks,
Martin
Website design and Develoment