Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-29-2012, 10:48 AM   PM User | #1
milanello72
New Coder

 
Join Date: Feb 2012
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
milanello72 is an unknown quantity at this point
How could I make links friendly?

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:
Code:
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:
Code:
href="index.php?page='.$name.'"
where $name could be motos or vehicles or...
How could I change href in my php file ? With preg_replace? Thank you very much!

Last edited by milanello72; 02-29-2012 at 10:49 AM.. Reason: How could I obtain friendly links?
milanello72 is offline   Reply With Quote
Old 03-01-2012, 05:02 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
PHP Code:
href="'.$name.'.html" 
?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 03-01-2012, 09:59 AM   PM User | #3
milanello72
New Coder

 
Join Date: Feb 2012
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
milanello72 is an unknown quantity at this point
Thank you for your message, I tried, but not working...
milanello72 is offline   Reply With Quote
Old 03-01-2012, 11:16 AM   PM User | #4
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
I tried, but not working...
What's not working? The PHP side/ rewrite side ?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 03-01-2012, 04:51 PM   PM User | #5
milanello72
New Coder

 
Join Date: Feb 2012
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
milanello72 is an unknown quantity at this point
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.
milanello72 is offline   Reply With Quote
Old 03-02-2012, 05:02 AM   PM User | #6
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
I think that php side not working...
Make use of the "view source" option of your browser to check the output of that code.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:26 PM.


Advertisement
Log in to turn off these ads.