Jump to content

Archived

This topic is now archived and is closed to further replies.

Demio

Mod Rewrite - help!

Recommended Posts

I'm currently using apache 2.0 in my server and I want to make a mod_rewrite rule so that anything that goes to /articles/stuff is redirected to articles.php?codename=stuff but I'm having a hard time.

This is my htaccess file:

[code]RewriteEngine on
RewriteRule ^/articles/([^/.]+)/?$ /articles.php?codename=$1  [L]
RewriteRule ^/([^/\.]+)/?$ $1.php [L][/code]

Can someone point me to the right way? :D

Share this post


Link to post
Share on other sites
[code]
RewriteEngine on
RewriteRule ^/articles/([a-z]+)/ $ /articles.php?codename=$1 [L]
RewriteRule ^/([a-z]+)/ $ /$1.php [L]
[/code]

That's how I would do it. Now obviously, that is allowing only a-z not any numbers.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.