Forum Moderators: phranque
I want to create the illusion of the following url:
mysite.com/ls/section/category/articlename
which really maps to:
mysite.com/ls/article.php?secID=section&catID=category&artID=articlename
Here's what I tried:
RewriteEngine On
RewriteRule ^ls/([A-Za-z0-9]+)/([A-Za-z0-9]+)/([A-Za-z0-9]+)/?$ article.php?secID=$1&catID=$2&artID=$3 [L]
This doesn't work - the page gives a "Server error" message, as does /ls/index.php :(
Any tips? The regexp is supposed to check for any string since the section names can be alphanumeric and contain basic symbols (hyphens etc). Thanks!
Completely flush your browser cache before testing after any code changes.
If it still doesn't work, post the relevant contents of your server error log.
And please post the exact URL(s) you are using to test this code.
Jim
Externally redirect requests for the dynamic URLs to the folder-based URL format, and force www into the URL at the same time for those, so that you can't serve duplicate content.
You might also want to add another redirect to strip index file filenames from URLs, forcing www at the same time for those.
Finally, you'll need one last redirect to force www if any non-www URL not covered by the other redirects is requested.
Before that, let's get the rewrite working first.
[edited by: g1smd at 9:06 pm (utc) on Sep. 30, 2008]