View Full Version : How could I make links friendly?

02-29-2012, 11:48 AM
Hello! I want to make the links friendly, but I have some problems. I want to change www.mysite.com/index.php?page=motos in www.mysite.com/motos.html
In .htacces I have written:

Options +FollowSymlinks

RewriteEngine on

RewriteRule ^([a-z0-9_]+).html$ index.php?page=$1

but it's not enough.
I think that I make some changes in my php file, too. In my php file I have:


where $name could be motos or vehicles or...
How could I change href in my php file ? With preg_replace? Thank you very much!

03-01-2012, 06:02 AM
href="'.$name.'.html" ?

03-01-2012, 10:59 AM
Thank you for your message, I tried, but not working...

03-01-2012, 12:16 PM
I tried, but not working...
What's not working? The PHP side/ rewrite side ?

03-01-2012, 05:51 PM
I think that php side not working... It's for the first time when I try to work with htaccess and I haven't experience.

03-02-2012, 06:02 AM
I think that php side not working...
Make use of the "view source" option of your browser to check the output of that code.