Rewrite the Base URL with mod_rewrite

Posted by rotespferd on Server Fault See other posts from Server Fault or by rotespferd
Published on 2012-10-29T10:50:58Z Indexed on 2012/10/29 17:05 UTC
Read the original article Hit count: 196

Filed under:
|
|

My Domain example.com points to the directory public_html. In the directory public_html/php is my index.php file.

Now I want that the URL example.com points to *public_html/php/index.php*. I must do this with mod_rewrite because I have no access to the httpd.conf to do something wth Alias oder DocumentBase.

In the directory public_html is my .htacces filewith the following content:

RewriteEngine on
RewriteCond %{HTTP_HOST} exaple.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /php/index.php [L,QSA]

This do half of the job, because when I enter something like example.com/s in my browser it points to *public_html/php/index.php* as I want it to do. But when I just enter example.com it points to *public_html*.

What can I do to fix this?

© Server Fault or respective owner

Related posts about apache2

Related posts about mod-rewrite