I have a shared hosting plan with HostGator and multiple CI installations. For each installation, I've been able to successfully remove the "index.php" from the URL, but on my addon domain, none of my CSS, or JS, or image files load correctly.
Here is what I have for mod rewrite on the main domain开发者_如何学JAVA:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
And for my addon domain, I have this:
RewriteEngine On
DirectoryIndex index.php
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
The add-on domains are located at /public_html/domain.com/.
I haven't been able to modify anything that doesn't give me an Internal Server Error, 500.
Any ideas?
This is how I set it up to avoid the css not loading due to the rewrite. Hope it helps.
Add a folder in the document root for CI called assets. It's the folder where your system folder resides. Put all your scripts, css, images, etc in the assets folder.
Folders:
>CI Root
>>assets
>>>CSS
>>>Scripts
>>>Images
Then allow requests for assets to bypass index.php in the .htaccess file:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
精彩评论