This is my .htaccess file:
RewriteEngine On
RewriteBase /mydomainname.com/
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
This code is working on one hosting while not on the other. I tried by running this code on the both the hosting
1)on one hosting I have my code works without adding index.php in the url ie
www.mydomainname.com/contrlerName/functionname
2)On the other domain I need to add index.php in the url like :
www.mydomainname.com/index.php/contrlerName/functionname
what can be the problem?
Thanks in advance!
Remove teh RewriteBase line, That was probably required on your old one, but not no new. Thats non standard, it shouldn't really of been required. Probably they had some crazy virtual hosting setup.
It might also be your new hosting, doesnt allow .htaccess files, so it simply being ignored.
AllowOverride All|None|directive-type [directive-type]
Ensure allow override directive enables .htaccess
file in the second hosting where its not working.
http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
Just check what mod_rewrite work on your second hosting. Ask hosting support. There is like that hosting don't support rewrite.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.