Forum Moderators: phranque
* mysite.com/article/347953/name_of_article.html
* mysite.com/article/347953/name_of_article/
* mysite.com/article/347953/name_of_article
* mysite.com/article/347953/
* mysite.com/article/347953
And rewrite them to this index.php?module=article&id=347953, essentially discarding everything after the id number.
I have come up with my own RewriteRule and it works on my home server (WAMP5 using Apache2), however when I upload the .htaccess file to my site which is using Apache/1.3.39, the RewriteRule does not work -- I get a 404 error.
RewriteRule ^article/(d+)(/[A-Za-z0-9_/]+)(.html)?$ index.php?module=article&id=$1 [NC]
Is there an error in my RewriteRule? Perhaps there is a better way to write it.
I assumed, in the light of no other examples, that the ID is always numeric and always six digits long.
You don't need to end-anchor this pattern, nor do you need to "collect" any characters after the second slash.
I would note that this rewrite will give you Infinite Dupliccate Content.
Malformed links to your articles will be indexed as new URLs, as will stuff like yoursite.com/article/347953/this_product_is_dangerous and yoursite.com/article/347953/we_are_criminals.
Bad move.