Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I just set up Apache and PHP on a server running CentOS by using something along the lines of yum install httpd and yum install php.

I've created the following file in /etc/httpd/conf.d/vhosts.conf:

NameVirtualHost *:80

<VirtualHost *:80>
     ServerAdmin contact@domain.com
     ServerName dl.domain.com
     ServerAlias dl.domain.com
     DocumentRoot /var/www/dl.domain.com/html
     ErrorLog /var/www/dl.domain.com/logs/error.log
     CustomLog /var/www/dl.domain.com/logs/access.log combined
</VirtualHost>

Not that it isn't actually domain.com, it's the actual domain that I'm using.

Then, in /var/www/dl.domain.com/html/.htaccess I have the following:

RewriteEngine On
# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

The problem is I'm getting 404 not found errors when accessing a URL like http://dl.domain.com/something/somethingelse. The requests don't seem to be going through the index.php script which the .htaccess file tells them to.

I've tried setting RewriteBase to /var/www/dl.domain.com/html/ but still no luck.

I have the same thing set up on localhost for development and it works perfectly. Can anyone spot what might be going wrong here?

share|improve this question
    
1) Why not put the rewrite stuff in the apache config as well? 2) httpd.apache.org/docs/2.2/mod/core.html#allowoverride –  andol Feb 23 '13 at 21:23

1 Answer 1

Check whether there is a directive in your Apache config and there is AllowOverride. If should be set on All. If it is not there, add it to make sure the .htaccess file is being read.

Wishes,

Mohammad Ali Sharpasand

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.