Page 1 of 1

php directory urls

Posted: Fri Jun 06, 2008 8:19 pm
by ayfine
hey all,

in ruby on rails, I know it is very easy to instead of having index.php?article=251 you could just have index/article/251. How would you go about doing this in php to have search engine friendly urls?

thanks

Re: php directory urls

Posted: Fri Jun 06, 2008 10:59 pm
by LSJason
Create a file called .htaccess in the directory in which index.php resides. Put this inside it:

Code: Select all

 
RewriteEngine On
RewriteRule index/(.*)/(.*) index.php?$1=$2
 
Should do the job.