Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Feb 2012
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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 11:49 AM. Reason: How could I obtain friendly links?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,864
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    PHP Code:
    href="'.$name.'.html" 
    ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Feb 2012
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for your message, I tried, but not working...

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,864
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    I tried, but not working...
    What's not working? The PHP side/ rewrite side ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    New Coder
    Join Date
    Feb 2012
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,864
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    I think that php side not working...
    Make use of the "view source" option of your browser to check the output of that code.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •