CodeIgniter Forums
htaccess doesnt work once uploaded to server - 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: htaccess doesnt work once uploaded to server (/thread-20859.html)



htaccess doesnt work once uploaded to server - El Forum - 07-23-2009

[eluser]rossmurphy[/eluser]
Hi,

I'm getting this error when i navigate to http://www.mysite.com/pgs/home.

Quote:The requested URL /index.php/home was not found on this server.

But when i navigate to http://www.mysite.com/pgs/index.php/home it works. I know it has something to do with my .htaccess file. It works on my local server.

Here is my .htaccess.

Code:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

Here is my config file:

Code:
$config['base_url'] = 'www.mysite.com/pgs';
$config['uri_protocol']    = "AUTO";

Anyone know why this wouldn't be working?

I have check mod rewrite is on.


htaccess doesnt work once uploaded to server - El Forum - 07-23-2009

[eluser]wowdezign[/eluser]
I used to have the same problem until I found out how to set the "Rewrite base". I don't know if that is what's wrong with your s or not, but I work on a local server and then upload to a production server so on the local one I have something like:

Code:
RewriteEngine On
RewriteBase/foldername/www/

But then on the production server it changes to something like:

Code:
RewriteEngine On
RewriteBase /

Hope that helps.


htaccess doesnt work once uploaded to server - El Forum - 07-24-2009

[eluser]rossmurphy[/eluser]
Thanks wowdesignz, it was the RewriteBase /.

Had to set it to:

Code:
RewriteBase /mysite/

Because the site is in a sub folder.


htaccess doesnt work once uploaded to server - El Forum - 07-24-2009

[eluser]wowdezign[/eluser]
Great. I like to help where I can.