So I have a basic web server setup with a LAMP stack on CentOS. It has mod_rewrite and all the basic modules. The routing I have used is working on other servers and locally. But when I try to use the routes on the new server they give me a 404 error. Now the kicker is that the regular default routes work (i.e. /index/my-page works but the special route /my-page does not on this server) so I know mod-rewrite is firing correctly. Also, there are no actual files with the route names so there is no conflict there.
My guess is something is not configured right for the router being I have done this before the same way and had no problem. I am wondering if anyone knows any potential little things that the router may need to run that I might have missed.
Thank you for any insight.
UPDATE: Here are the Rewrite htaccess entries I have tried
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php
and (from another Dev I work with)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ index.php [NC,L]
Here is the routes.xml aside from the extra markup for enviroments:
<routes>
<home>
<route>/home</route>
<defaults>
<controller>index</controller>
<action>index</action>
</defaults>
</home>
<lifetime-solutions-annuity>
<route>/lifetime-solutions-annuity</route>
<defaults>
<controller>index</controller>
<action>lifetime-solutions-annuity</action>
</defaults>
</lifetime-solutions-annuity>
<indexed-universal-life>
<route>/indexed-universal-life</route>
<defaults>
<controller>index</controller>
<action>indexed-universal-life</action>
</defaults>
</indexed-universal-life>
<wellness-for-life>
<route>/wellness-for-life</route>
<defaults>
<controller>index</controller>
<action>wellness-for-life</action>
</defaults>
</wellness-for-life>
<join&开发者_如何学Cgt;
<route>/join</route>
<defaults>
<controller>index</controller>
<action>join</action>
</defaults>
</join>
</routes>
Are you sure that AllowOverride All or at least AllowOverride FileInfo has been set? It sounds like Apache is ignoring the .htaccess file.
精彩评论