Reputation: 2743
I have this CMS set up in a folder called localhost:5999/madison/
The .htaccess
file (code below) is in the same folder localhost:5999/madison/
If, in a browser, I go to localhost:5999/madison/
or to localhost:5999/madison/index.php
or to localhost:5999/madison/xyz
where xyz is anything not containing forward slashes, it redirects me to the following file: localhost:5999/madison/inc/views/view-404.php
My question is: Why?
.htaccess code:
RewriteEngine On
ExpiresActive On
#Expire Header
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "now plus 7 days"
</FilesMatch>
ExpiresByType text/css "now plus 7 days"
ExpiresByType text/html "now plus 7 days"
ExpiresDefault "now plus 7 days"
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
RewriteRule ^(assets|inc) - [L]
RewriteRule ^admin[/]?$ admin/index
RewriteRule ^admin/edit/(.*)$ index.php?type=admin&action=edit&page=$1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^admin/(.*)$ index.php?type=admin&action=view&page=$1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^login$ index.php?action=view&type=login&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^forgot-password$ index.php?action=view&type=forgot-password&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^edit/user(/)?$ index.php?action=edit&type=user&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^signup(/)?$ index.php?action=edit&type=user&id=0&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^user/([0-9]+)(/)? index.php?action=view&type=note&user=$1&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^(suggestion|comment)/([0-9]+)(/)? index.php?action=view&type=note&page=open¬e_type=$1¬e=$2&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^([0-9A-Za-z\-_]+)/(suggestion|comment)/([0-9]+)(/)? index.php?action=view&type=note&page=$1¬e_type=$2¬e=$3&%1 [L]
#Catch All Pages
RewriteRule ^index\.php$ - [L]
RewriteCond %{QUERY_STRING} ^(.*)?$
RewriteRule ^([0-9A-Za-z\-_]+)(/)? index.php?action=view&type=page&page=$1&%1 [L]
Upvotes: 0
Views: 99
Reputation: 2691
The issue arises because you are hosting the CMS in a sub-folder localhost:5999/madison/
(without changes to the configuration file) and not directly in localhost:5999/
To solve the issue, make the following changes to config.php
in /madison/inc/
directory:
config.php
/**
* Server Definitions
*/
define('SERVER_ABS', $_SERVER['DOCUMENT_ROOT']);
define('SERVER_URL', 'http://'.$_SERVER['HTTP_HOST']);
To:
/**
* Server Definitions
*/
define('SERVER_ABS', $_SERVER['DOCUMENT_ROOT'].'/madison');
define('SERVER_URL', 'http://'.$_SERVER['HTTP_HOST'].'/madison');
Upvotes: 1
Reputation: 784928
That seems to be borne out for some custom 404 handler outside your current .htaccess.
Try adding these lines on top of your .htaccess:
DirectoryIndex index.php
RewriteEngine On
RewriteBase /madison/
And keep your last rule as:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ index.php?action=view&type=page&page=$1 [L,QSA]
Then test this in a new browser to avoid old caches.
Upvotes: 1