Configure New Server for .htaccess

Posted by Phil T on Server Fault See other posts from Server Fault or by Phil T
Published on 2013-07-01T22:51:03Z Indexed on 2013/07/01 23:06 UTC
Read the original article Hit count: 207

Filed under:
|
|

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 [email protected]
  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.

© Server Fault or respective owner

Related posts about linux

Related posts about apache2