1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

.htaccess on localhost

Discussion in 'Apache' started by anton-io!, Apr 7, 2005.

  1. #1
    Hello!

    I am running the .htaccess file online on the server - no problems there ...

    My problem is when I try to run it on localhost ... nothing ...

    PHP code/MySQL everything else is great

    Here's a sample of the server version .htaccess file ...

    Options +FollowSymLinks
    rewriteEngine on
    rewriteBase /
    RewriteCond %{HTTP_HOST} ^h**p://www.somethingseomething.com/
    RewriteRule ^(.*)\.htm$ /view-this.php?UID=$1 [L]
    ... etc ...

    this works great on the server ... on the localhost, I changed
    SEMrush
    RewriteCond %{HTTP_HOST} ^h**p://www.somethingseomething.com/
    to
    RewriteCond %{HTTP_HOST} ^h**p://localhost/something

    nothing ...

    I'm using Sokkit (should really not make a difference), PHP, etc ...

    any ideas - thanks greatly!
     
    anton-io!, Apr 7, 2005 IP
    SEMrush
  2. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think that localhost can actually get translated into different values of HTTP_HOST - the local IP address, the machine name if you have one assigned, etc.

    Try not specifying the host, as you know its going to be localhost on your machine, right?

    You could maybe try
    RewriteCond %{HTTP_HOST} ^.*$​
    and see if that works.

    Hope it helps

    John
     
    johnt, Apr 8, 2005 IP
  3. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #3
    whats you localhost? Sure you run apache?

    RewriteCond %{HTTP_HOST} ^h**p://something

    should work
    Expat
     
    expat, Apr 8, 2005 IP
  4. NetworkTown.Net

    NetworkTown.Net Well-Known Member

    Messages:
    2,022
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    165
    #4
    I am using xampp (apache) localhost and .htaccess dose not work on it too.
     
    NetworkTown.Net, Feb 6, 2007 IP
  5. webglobesolutions

    webglobesolutions Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi !! Initially I had the same problem when I started working on .htaccess. I found that it never works in localhost, so I assumed may be .htaccess is does not work in localhost. Later I got to know that when you are working with .htaccess, you need to check whether the rewrite engine is on or off. It should be on. I fit still does not work then check your .htaccess code syntax. That must be wrong somewhere, even a very very small error also does create the same problem.

    So, let me know if i could help you or not. feel free to contact with me http colon:)) slash slash (//) www dot webglobesolutions dot net slash(/) contact-us slash(/)
     
    webglobesolutions, Sep 20, 2010 IP
  6. bopelogy

    bopelogy Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi!
    I have the same problem, I know what can be the problem is , but I dont know how to solve it. The problem is that I use for css relative link and in .htaccess I use RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$ for it. That's working for me...but in localhost I use wamp server and the absolute path is localhost/mysite/index.php...When I put css folder into the root folder(WAMP server root folder is called WWW) it's working fine
    WWW directory
    ..
    mysite --css
    index.php
    css
     
    bopelogy, Dec 10, 2011 IP
  7. Leno B

    Leno B Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hi,

    My opinion is to contact your webhost management and they can surely assist you on this.
     
    Leno B, Dec 10, 2011 IP
  8. bopelogy

    bopelogy Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I solved :)
    my css file have a relative link css/style.css
    I use this condition in .htaccess: RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$
    The solution: In remote host I use in HEAD section base href http://www.mysite.com/ and in localhost I use http://localhost/mysite/ and I put it as a variable into my config.php file
     
    bopelogy, Dec 10, 2011 IP