Reputation: 1383
I'm using a shared linux hosting and have created subdomain which points to /hrms folder inside the root folder.
Now, I've a mod rewrite condition for this subdomain only which goes like this:
RewriteEngine On
RewriteBase /hrms/
RewriteCond %{REQUEST_URI} !^/static/images
RewriteCond %{REQUEST_URI} !^/static/js
RewriteCond %{REQUEST_URI} !^/static/css
RewriteRule ^/(.*)$ /index.php?request=$1 [PT,QSA,L]
But I'm getting this error when I try to login:
Not Found The requested URL /login was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Also, I tried to check if .htaccess is parsed and when I added some junk, the server gave 500 Internal error, so .htaccess is also parsed and is not a problem.
I already searched for same error in google and stackoverflow, but didn't found the mistake I'm doing.
Please help! Thanks...
Atul Yadav. atulmy.com
Upvotes: 0
Views: 1008
Reputation: 10888
I assume that your shared hosting service (SHS) provider provides some subdomain mapper console so the mapping of http://hrms.atulmy.com/
to ~/hrms
is done through and SHS-specific RewriteMap
in its vhost config.
.htaccess
; dropping a phpinfo script into ~/hrms
and doing a http://hrms.atulmy.com/phpinfo.php
http://hrms.atulmy.com/login
has a REQUEST_URI /login
your RewriteBase
should be simply /
and you should use ~/hrms/.htaccess
^/
in an .htaccess
rewrite rule..htaccess
rewrite rule unless you want to rewrite to a different directory hierarchy.http://atulmy.com/hrms/
index.php
so you need a guard condition, the easiest way is to use a file existence check which removes the need for the existing static checks .Giving:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} =atulmy.com
RewriteRule hrms/(.*) http://hrms.atulmy.com/$1 [R=301,L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*) index.php?request=$1 [PT,QSA]
If you don't like this then replace this last condition by:
RewriteCond %{REQUEST_URI} !^/static/(images|js|css) [OR]
RewriteCond %{REQUEST_URI} !^/index\.php
Upvotes: 1
Reputation: 286
Can you post more of your Htaccess file? If I try:
http://hrms.atulmy.com/index.php?request=login
It sends me to:
http://hrms.atulmy.com/login
Upvotes: 0
Reputation: 15778
How about this:
RewriteEngine On
RewriteBase /hrms/
RewriteCond %{REQUEST_URI} !^/static/(images|js|css)
RewriteRule (.*) /index.php?request=$1 [PT,QSA]
? Tell me if it works.
Upvotes: 0