Hi everyone,
Currently I'm experimenting with URL rewriting (within Apache) for usabilty and search engine optimization purposes. Everything works fine on the hosting platform running the website on its domain. However, my local development setup is not quite suitable for testing URL rewriting locally, because the directory structure is different. Suppose I have a website for the domain site.com and I'm using URL rewriting.
Root:
http://www.site.com
(redirected to file: home.php)
Homepage:
http://www.site.com/home
(redirected to file: home.php)
Some product:
http://www.site.com/products/13
(redirected to file: products.php?productId=$1)
Now, locally I enter this site by the following URL:
http://localhost/site.com/
It follows that, especially with URL rewriting, this setup (where the root is different) is problematic regarding (absolute) paths.
My questions concerns this issue. Is there a way to configure Apache to treat directories on localhost as absolute domains? So, for example, that the root of http://localhost/site.com/ is not localhost, but, indeed, site.com? That way developing with URL rewriting is much easier, because the local setup, regarding the file structure, compares to the live one.
Thanks in advance!
Local webdeveloment with Apache: treating folders as domains
Moderator: General Moderators
-
Jeroen Oosterlaar
- Forum Commoner
- Posts: 37
- Joined: Sun Nov 06, 2005 4:12 pm
Just checkout the virtual host configuration stuff... eg:
All i had to to is make sure that both gsf and timvw resolve to 127.0.0.1... And now i can surf to both sites 
Code: Select all
NameVirtualhost *:80
<VirtualHost *:80>
ServerName gsf
DocumentRoot "F:/websites/gsf/web"
<Directory "F:/websites/gsf">
AllowOverride All
Options All
</Directory>
</Virtualhost>
<VirtualHost *:80>
ServerName timvw
DocumentRoot "F:/websites/timvw"
<Directory "F:/websites/timvw">
AllowOverride All
Options All
</Directory>
</VirtualHost>-
Jeroen Oosterlaar
- Forum Commoner
- Posts: 37
- Joined: Sun Nov 06, 2005 4:12 pm
Thanks a lottimvw wrote:All i had to to is make sure that both gsf and timvw resolve to 127.0.0.1... And now i can surf to both sites
I have succesfully configured the virtual host and I resolve the domain I use to 127.0.0.1. But now I have a problem with the .htaccess file, which is not being called for some reason. Does a certain directive need to be set to instruct Apache to call the .htaccess file in the root of the virtual host?
Never mind, I solved it