Using .htaccess to remove index.php (yes another one) |
[eluser]peterbz[/eluser]
I know you're probably thinking "Oh my.. another one of these problems!" Yes, I did check the forums for a solution, but it doesn't seem to work. I've set up Apache (version 2.2) on my Windows PC, edited the httpd.conf to allow mod_rewrite, and placed a .htaccess file in the root of my CodeIgniter directory, but it doesn't seem to do the trick. My apache running dir is C:\htdocs I've placed the .htaccess in C:\htdocs\Websites\WeddingPlace\ (I've renamed the CodeIgniter folder to WeddingPlace, so the index.php is inside directory WeddingPlace) Here's the changes in httpd.conf Code: <Directory "C:/htdocs"> and I uncommented the line: Code: LoadModule rewrite_module modules/mod_rewrite.so Here's my .htaccess: Code: RewriteEngine on I've also changed the config.php file in Codeigniter: Code: $config['base_url'] = "http://localhost/Websites/WeddingPlace/"; I've restarted Apache many times after each edit to httpd.conf, so it shouldn't be a problem of restarting. If anyone can help, it'd be much appreciated. Thanks!
[eluser]hugle[/eluser]
Hello. what error do you get ? I have zero experience with Windows servers, but: have you tried to put your system directory with a index.php file right into: C:/htdocs And check if it works ?
[eluser]peterbz[/eluser]
It gives me a 404 Not Found It works when I try http://localhost/Websites/WeddingPlace/i...hp/welcome but when i try http://localhost/Websites/WeddingPlace/welcome it doesn't work I also tried to put the whole thing right in C:/htdocs but that also doesn't work I think the problem is that I don't have mod_rewrite properly enabled in Apache since I tried phpinfo() and I couldn't locate mod_rewrite in there. If anyone can help me properly configure Apache, it'd be great.
[eluser]hugle[/eluser]
Hello. try this .htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [QSA,L] put it into Websites/WeddingPlace/.htaccess P.S. are you sure htaccess file is working ? Try changing from : Code: <Directory "C:/htdocs"> to: Code: <Directory "C:/htdocs">
[eluser]uptime[/eluser]
Just to make sure you've tried it... Try to change this: Code: RewriteRule ^/(.*)$ /index.php/$1 [L] To that: Code: RewriteRule ^/(.*)$ /index.php/?$1 [L]
[eluser]peterbz[/eluser]
Thanks for replies, but I've tried your above steps and it still doesn't work. I think it's my Apache configuration, because I tried phpinfo() and I could not locate mod_rewrite on there.
[eluser]ray73864[/eluser]
seems like you are doing this from a subdirectory, in which cause you need the RewriteBase (i think it is) set so that the .htaccess knows where it is working from. also, phpinfo() only shows config stuff for php, mod_rewrite is an apache thing so you wouldn't see it in there anyway.
[eluser]uptime[/eluser]
ray73864 - good point, I didn't notice it was a subdirectory. peterbz - Does it give you the server's 404 or CI's 404?
[eluser]peterbz[/eluser]
It gives me server's 404 So what should the RewriteBase be? EDIT: I tried this but still doesn't work: Code: RewriteEngine on The htaccess file is inside C:/htdocs/Websites/WeddingPlace/
[eluser]uptime[/eluser]
The server's 404? What if rename .htaccess (to disable it) and go to index.php - do you get to CI's welcome page? |
Welcome Guest, Not a member yet? Register Sign In |