.htaccess and links on localhost (Sufficiently Resolved)
Posted: 04. December 2007 18:49
OK, so, as I'm sure most of you are doing, I'm modifying my websites on my localhost. I have them under a folder to separate the website files from the XAMPP files. Now, I noticed that, since $_SERVER[HTTP_HOST] is localhost, all my links go to localhost/link_name, versus localhost/folder/link_name but ONLY when I'm using localhost, since I obviously don't want to switch anything when I go to my live server.
I've been trying to research how to accommodate so that I don't have to manually change the URLS with an if statement, but I can't seem to figure out how. I'm guessing the only way is to use .htaccess, but I can't find the code. I know I can do <a href="linkname">, but I hate that syntax as well, mainly because I have an include file that, even in the subdirectories, writes links to the main directory. I prefer to do <a href="/linkname">.
I have another folder for another website that I have, so I don't want to change the host name in http.conf. What are my options? I've tried looking this stuff up on Google, but the only answers I'm getting are for removing the www from the domain name.
[Edited to make paragraphs]
I've been trying to research how to accommodate so that I don't have to manually change the URLS with an if statement, but I can't seem to figure out how. I'm guessing the only way is to use .htaccess, but I can't find the code. I know I can do <a href="linkname">, but I hate that syntax as well, mainly because I have an include file that, even in the subdirectories, writes links to the main directory. I prefer to do <a href="/linkname">.
I have another folder for another website that I have, so I don't want to change the host name in http.conf. What are my options? I've tried looking this stuff up on Google, but the only answers I'm getting are for removing the www from the domain name.
[Edited to make paragraphs]