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

I have a new LAMP CENTOS 5 server I am setting up and trying to copy the configuration from another web server I have. I am stuck with what I think is a mod_rewrite problem. If I go to http://old-server.com/any_page_name.php it correctly routes through some handling code in index.php and shows me a graceful "Page Cannot Be Displayed" message.

But if I go to http://new-server.com/any_page_name.php I get an ugly Apache 404 Not Found error message.

I looked in both httpd.conf files and they both have only one reference to mod_rewrite. LoadModule rewrite_module modules/mod_rewrite.so So it seems like that should be fine.

At the bottom of httpd.conf I have the code:

<VirtualHost *:80>
  ServerAdmin webmaster@dummy-host.example.com
  DocumentRoot /var/www/html
  ServerName new-server.com
  ErrorLog logs/new-server.com-error_log
  CustomLog logs/new-server.com-access_log common
</VirtualHost>

Then in the root of /var/www/html I have the exact same .htaccess file that looks like this:

RewriteEngine on
Options +FollowSymlinks

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

ErrorDocument 404 /page-unavailable/

<files ~ "\.tpl$">
order deny,allow
allow from none
deny from all
</files>

So I don't see why the page load at old-server.com works fine while new-server.com doesn't route through index.php like I want it to do.

Thanks.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You might need to set the AllowOverride All option to allow .htaccess files.

On a sidenote: Maybe you should think about moving the server logic into the server config.

share|improve this answer
    
Yes, that did the trick. Thank you. –  Phil T Jul 2 '13 at 4:31
add comment

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.