CodeIgniter Forums
problem with .htaccess an DOCUMENT_ROOT - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: problem with .htaccess an DOCUMENT_ROOT (/showthread.php?tid=9114)



problem with .htaccess an DOCUMENT_ROOT - El Forum - 06-12-2008

[eluser]dexter21[/eluser]
Hi, i've recently finished a project with ci. Now i want to redirect with .htaccess . my phpinfo said that i've load mod_rewrite module. My DOCUMENT_ROOT is /usr/clients and the project is in /usr/clients/client1 . i put a .htaccess file with following content in /usr/clients/client1/


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

but when i call to http://myserver/client1/contact.html i get

Not Found

The requested URL /client1/contact.html was not found on this server.


and dont get error of .htaccess file. any help plz?


problem with .htaccess an DOCUMENT_ROOT - El Forum - 06-12-2008

[eluser]parrots[/eluser]
Try this:

Code:
RewriteEngine on
RewriteBase /client1/
RewriteCond $1 !^(index\.php|images|imgs|tmp|public|downloads|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

RewriteBase is helpful when you're not running in the root of a domain.

Also make sure in config.php you've set $config['index_page'] to "" and $config['url_suffix'] to ".html" (since it looks like you want all your pages to have the extension .html).


problem with .htaccess an DOCUMENT_ROOT - El Forum - 06-12-2008

[eluser]dexter21[/eluser]
many thanks but nothing has changed, same error.


problem with .htaccess an DOCUMENT_ROOT - El Forum - 06-15-2008

[eluser]exit[/eluser]
This should work:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|imgs|tmp|public|downloads|robots\.txt)
RewriteRule ^(.*)$ /client1/index.php/$1 [L]