Fred Lin Design Studio is a web design studio based in Singapore and Shanghai. With our constantly growing list of accounts, we have proven ourselves to be THE go-to source of quality and reliable web design & development services for clients across Singapore, China, Taiwan, United States, Germany and Switzerland.


Getting your CodeIgniter .htaccess mod rewrite to work on Network Solutions

Getting your CodeIgniter .htaccess mod rewrite to work on Network Solutions

20 August 2010, 02:22

 You would've thought, given the big reputation of the popular hosting server, Network Solutions, you wouldn't run into any problems implementing something as basic as a modrewrite in a .htaccess. Hell we do that on our cheapo local host without a single problem all the time!

But lo and behold, it is true, Network Solutions do not implement .htaccess very well, for some reason. Which is silly, because nearly every other CMS/Blog solution out there these days utilize modrewrite for SEO friendly URLs. Thankfully, the problem is not without a solution.

We use the CodeIgniter PHP framework, this is our solution for getting the modrewrite to 'remove' the index.php from your URLs, using .htaccess, on a Network Solutions unix host.

Tip #1 
If your .htaccess contains <ifmodule mod_rewrite.c=""> </ifmodule>, remove them. Just do it.
 

Tip #2
This the exact .htaccess that worked for our CodeIgniter installation.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

Something to take note of is the trailing slash infront of index.php, as well as the ? behind it. Again, don't ask why, just do it. :)

That should do the trick.

 

 



« Back

Comments

Fred Lin
Fred Lin
23 September 2011, 11:31am
Hi Vikki, Just to confirm, are you trying to do this with a codeigniter application?
Vikki
Vikki
23 September 2011, 02:49am
Great post! I used your code as written. I need to get a client's site to work on Network Solutions hosting (they insist). I am trying to keep the url suffix in tact. This works: example.com/somename example.com/another/name This doesn't: example.com/somename.html example.com/another/name.html Any idea as to why?
Riley
Riley
07 October 2010, 12:28am
THanks for the post! I just built my 5th codeigniter site, and a client finally was using NetSol as their host. I was going crazy trying to figure this out... Bravo!