Problem rewriting links in htaccess |
Hey, I have "index.php?" in my links, I have searched for a solution all over the forum
and I could'nt find something that works for me. "http://mywebsite.com/index.php?video/xxxxxx" I am trying to change it to "http://mywebsite.com/video/xxxxxx" now, I have tried to it in htaccess with no success. RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/$1 [L] What I am doing wrong? HELP ![]() ![]()
Hey chiefdongas,
Check your config.php in the config folder. Look for the following line and check that index_page is not set to the default value, index.php: Code: $config['index_page'] = ''; It should be set to an empty string when you use rewrite. Good luck! -Rogier (02-05-2015, 07:57 AM)chiefdongas Wrote: Hey, I have "index.php?" in my links, I have searched for a solution all over the forum First thing is if you are using the link helper --> anchor() function and are still getting an index.php in your links, that means you have to go to your config file and update your index page --> Go to your application/config/config.php file ->Go to about line 30 and change: PHP Code: $config['index_page'] = 'index.php'; Also i'm not great with .htaccess rules but here is mine that works: Code: <IfModule mod_rewrite.c>
Thank you for the fast respond
I have changed the config and the htaccess and now the link http://mywebste.com/?video/xxxxxx works but when I try "http://mywebste.com/video/xxxxxx" it goes to 404. I'm stuck with that question mark any toughts?
Lose the ? in the following line:
Code: RewriteRule ^(.*)$ /index.php?/$1 [L] What you get is obviously: Code: RewriteRule ^(.*)$ index.php/$1 [L] Good luck! -RogerMore
(02-06-2015, 02:03 AM)chiefdongas Wrote:(02-06-2015, 01:28 AM)RogerMore Wrote: Lose the ? in the following line: Hi, check config item... $config['enable_query_strings'] it must be FALSE!
Here are my .htaccess that works great in my local pc and in production using a vps
For local use with http://localhost/ or production with a domain like http://example.com/ Code: RewriteEngine on For user directory (mod_userdir enabled) something like: http://example.com/~userdir/project/ Code: RewriteEngine on In both cases I use: PHP Code: $config['base_url'] = ''; Hope this helps |
Welcome Guest, Not a member yet? Register Sign In |