How to make htaccess working with Windows XP & XAMPP?

Discussion in 'Apache' started by KingCobra, Jul 11, 2012.

  1. #1
    Dear friends,

    I am a PHP web developer.

    I am using Windows XP (SP-2) and XAMPP 1.7.4 web server as my local host.

    Please tell me the steps how can I use .htaccess url rewriting. That mean how I make it working?

    No need url rewrite codes inside .htaccess file, just need it working in my pc's localhost.

    It may need editing "conf/httpd.conf"......

    Please help. Thanks
     
    KingCobra, Jul 11, 2012 IP
  2. GMF

    GMF Well-Known Member

    Messages:
    855
    Likes Received:
    113
    Best Answers:
    19
    Trophy Points:
    145
    #2
    Found something that might help you

    
    http://www.lancelhoff.com/enabling-htaccess-in-apache-on-windows/
    
    Code (markup):
     
    GMF, Jul 11, 2012 IP
  3. KingCobra

    KingCobra Well-Known Member

    Messages:
    289
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #3
    GMF, thanks for your url.
    I did the same thing and it may be working because I download a full site form live online server with htaccess file and placed all files to my localhost and url rewriting working here. When I move my cursor on a dynamic link it shows a friendly url in the status bar and also when I click the link it goes to friendly url. So i am sure url rewriting working.

    But I made a site and placed it to localhost. but the url rewriting not working. Do I need to add any code in my PHP files?

    Suppose, my link is:
    http://localhost/mysite3/pages.php?name=terms
    I want like bellow:
    http://localhost/mysite3/page/terms

    What will be the url rewriting code?
     
    KingCobra, Jul 11, 2012 IP
  4. GMF

    GMF Well-Known Member

    Messages:
    855
    Likes Received:
    113
    Best Answers:
    19
    Trophy Points:
    145
    #4
    I think the code would look like this

    
    RewriteEngine On
    RewriteRule ^mysite3/pages/terms$ /mysite3/pages.php?name=terms [L]
    
    Code (markup):
    Just create a file with the name ".htaccess" and paste the code into it.
     
    GMF, Jul 11, 2012 IP
  5. KingCobra

    KingCobra Well-Known Member

    Messages:
    289
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #5
    GMF,

    Here is my very simple 2 page test site. Would you please make it user friendly by url rewriting?

    View attachment site3.zip

    I placed it in my localhost and the ugly url looks like bellow:

    http://localhost/site3/program.php?action=event&sp=50

    But I like the bellow:

    http://localhost/site3/prog/event/50

    Please download the file (less than 1 kb) and place in your localhost and use the htaccess file, then send me back.

    I will be very great full to you. I spent my whole day today but cant solve this problem myself.

    Thank you
     
    KingCobra, Jul 11, 2012 IP