PDA

View Full Version : VirtualHost and\or mod_rewrite



aramana
06-11-2007, 03:37 PM
My structure is something like this:

$HOME/public_html/avinash

To access that, it's http://aramana.org/avinash

I would like to access it via http://aramana.org, but I do not want to change the location of it's folder in the fs. Is there a way to do this using mod_rewrite or vhost configuration?

-Avinash

areidmtm
06-11-2007, 05:30 PM
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?aramana.org$
RewriteCond %{REQUEST_URI} !^/avinash/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /avinash/$1
RewriteCond %{HTTP_HOST} ^(www.)?aramana.org$
RewriteRule ^(/)?$ avinash/index.php [L]

aramana
06-11-2007, 07:17 PM
Thank you! That works beautifully. Might I ask where you learned that? I'm not a pro with regex yet, but I can understand yours. I was really iffy on the syntax. Thanks a bunch mate!

-Avinash

areidmtm
06-11-2007, 07:28 PM
...Might I ask where you learned that?...
Searching Google is a wonderful thing ;)

KenJackson
06-14-2007, 04:01 PM
You can also go to the official documentation:
Apache 1.3 URL Rewriting Guide (http://httpd.apache.org/docs/1.3/misc/rewriteguide.html)