Results 1 to 2 of 2
Thread: mod rewrite - redirect problem
Dec 28, 2011, 07:46 #1
- Join Date
- Dec 2011
- 0 Post(s)
- 0 Thread(s)
mod rewrite - redirect problem
I have created a simple dynamic website with php and I am having trouble making my URL structure search engine friendly.
What I am trying to do is redirect links like this
It seems to be backwards to every other solution I have seen, when I add R=301 into the rule it redirects the nice url to the long version.
RewriteEngine On RewriteRule ^([^/\.]+)/$ /index.php?page=$1 [L]
1. It doesn't actually redirect the URL, it just allows both version to work.
2. If I tried to use the new url without the trailing backslash
Any help will be much appreciated
Dec 28, 2011, 22:49 #2
- Join Date
- Feb 2002
- 19 Post(s)
- 3 Thread(s)
What've you attempted was not a bad effort but I'd REALLY advise not mimicing directories (trailing /'s) as that introduces an incorrect directory level in the path for your relative links.
If you're assured that your "animals" will always be lowercase characters, I'd useCode:
RewriteEngine on RewriteRule ^([a-z]+)$ index.php?page=$1 [L]