CodeIgniter Forums
removing ? from urls - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: removing ? from urls (/thread-3639.html)



removing ? from urls - El Forum - 10-15-2007

[eluser]bkozora[/eluser]
What I'm attempting to do is remove the ? from my CI urls. I've got it omitting index.php, but my urls are rather ugly, appearing like this:

http://76.12.66.93/?projects
http://76.12.66.93/? - returns the default, my home page

How can I get http://76.12.66.93/projects to correctly direct to my projects controller?

I've been fiddling with this for a couple hours over multiple days now, and haven't seen any solutions that fit, if this is a duplicate of another post my sincerest apology's, I couldn't find it on the forums.

Thanks!


removing ? from urls - El Forum - 10-15-2007

[eluser]instantations[/eluser]
Here's a sample of my working configuration:

.htaccess


Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]

application/config/config.php (only the lines invovlved shown here)

Code:
$config['index_page'] = "";
$config['url_suffix'] = "";
$config['enable_query_strings'] = FALSE;

I'm still a beginner but this works for me.


removing ? from urls - El Forum - 10-15-2007

[eluser]bkozora[/eluser]
Thanks for your fast response! I tried what you mentioned and it gave me a internal 500 error. My config.php was set up with the same values you mentioned, the htaccess was the culprit. The site's hosted through HostMySite, some local company here in Delaware. I forgot about this, but I suspected earlier that maybe they didn't allow rewrites through htaccess or something. I found a method detailing alternate steps, but those didn't work either. I'll call up HostMySite and see what settings i can tinker with through htaccess. I'll post anything valuable I find.

As far as SEO and everything, is there any valuable reason why I shouldn't just settle for the ugly ?'s in the addresses?


removing ? from urls - El Forum - 10-15-2007

[eluser]charlieD[/eluser]
Try this:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|flash|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

Note the '?' after index.php - with some web hosts the '?' is required.


removing ? from urls - El Forum - 10-15-2007

[eluser]sergitin[/eluser]
try with
Code:
header('location: page.php')



removing ? from urls - El Forum - 10-15-2007

[eluser]bkozora[/eluser]
I contacted HostMySite (my hosting company). They informed me that due to security reasons they don't allow rewrites, but told me they take custom requests which they'll review and decide upon. Being as I have 30+ sites with them I'm thinking they'll allow an exception for my accounts...

Thank you all for your help!


removing ? from urls - El Forum - 10-15-2007

[eluser]Michael Wales[/eluser]
security concerns?

My advice, head on over to another host and switch today. LunarPages will actually buy out the rest of your remaining contract with your current company. I am on DreamHost and albeit there have been a few hiccups they've proved worthwhile for me so far (and you can find tons of coupons which will give you your first year at around $20).