Jump to content


Mod Rewrite - help!

  • Please log in to reply
1 reply to this topic

#1 Demio

  • Members
  • PipPip
  • Member
  • 22 posts

Posted 13 August 2006 - 05:51 PM

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:

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

Can someone point me to the right way? :D

#2 Nexous

  • Members
  • PipPip
  • Member
  • 14 posts

Posted 13 August 2006 - 07:04 PM

RewriteEngine on
RewriteRule ^/articles/([a-z]+)/ $ /articles.php?codename=$1 [L]
RewriteRule ^/([a-z]+)/ $ /$1.php [L]

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

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users