0

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 i.e

 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!

3
  • The code is the same on both hosting? Commented Mar 6, 2013 at 15:49
  • as someone answered before, you must remove RewriteBase /mydomainname.com/ or rename the "mydomainname.com" to your new domain name. And you have to be sure that mod_rewrite is enable, if not contact yor hosting service Commented Mar 6, 2013 at 16:00
  • See my answer to this question. It is most likely the cause of your problems. Commented Mar 7, 2013 at 7:00

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, but what is the actual error. Find out the actual error, rather than guessing. Surely you dont do all development by trial and error?
1

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

Comments

0

Just check what mod_rewrite work on your second hosting. Ask hosting support. There is like that hosting don't support rewrite.

1 Comment

yes it is not enabled but I am using shared hosting ,any idea how to enable it on shared hosting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.