News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

RewriteRule Help

Started by 127.0.0.1, May 28, 2008, 07:18:18 PM

Previous topic - Next topic

127.0.0.1

I want a RewriteRule that will take any of the following URLs:


And rewrite them to this index.php?module=article&id=347953

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 also tried a more general RewriteRule ^article/(\d+)(.*) index.php?module=article&id=$1 [NC] and I still get a 404! Argh.

127.0.0.1

#1
Solved.

Got it to working using RewriteRule ^article/([0-9]+)/ index.php?module=article&id=$1 [NC]

However, I realised discarding anything after the id number may be a liability as anyone can enter anything, for example: mysite.com/article/4533/this_site_is_full_of_criminals and this can be crawled creating duplicate content.

Hmm.

Advertisement: