• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
removing ? from urls

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: - returns the default, my home page

How can I get 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.


Here's a sample of my working configuration:


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)

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

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

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?

Try this:

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.

try with
header('location: page.php')

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!

[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).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.