0

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?

0

1 Answer 1

1
RewriteCond %{REQUEST_FILENAME} !-f 

The !-f flag means "if the requested file doesn't exist". When accessing example.com, the Apache DirectoryIndex directive redirects the request to /public_html/index.php, does this file exist? Because if it does, your RewriteRule is ignored. You have to either remove the RewriteCond above, or remove the /public_html/index.php file.

1
  • Ok, thanks for your hint, there was a index.html in the public_html folder from my hoster. I deleted this file and everything works. Thank you very much :) Commented Oct 29, 2012 at 12:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.