.htaccess index.php rewrite not working on user directory |
Hello All, I need some help with this:
I'm using codeigniter 2.x and I have a .htaccess for rewrite the index.php, it works great if I put my projects on /var/www or if I make a virtual host for it. But I want to use my user directory such as http://localhost/~userdir/myproject. If I use my user directory when I'm trying to do request to a controller like: http://localhost/~userdir/myproject/signup I get this error: Quote:Not Found This is my current configuration: .htaccess Code: RewriteEngine on application/config/config.php PHP Code: $config['base_url'] = ''; This config works great on http://localhost/ and also on production enviroments with a domain like http://example.com/ but not on my user directory http://localhost/~userdir/project/ neither on production like http://example.com/~userdir/project Any thoughts? Thanks in advance.
(02-05-2015, 02:08 PM)Narf Wrote: RewriteBase /~userdir/myproject/ Awesome, thanks!!! that works great! I put the line that you've suggested and removed the slash before index.php on last line. This is my new .htaccess Code: RewriteEngine on ![]()
This line is redundant:
Code: RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico) As these two lines cover it, and all other real files/directories. They basically say "if the request is not for a REAL file, and the request is not for a REAL directory, pass the request to index.php. Presumably everything from the above line is a real file or directory, so it's not needed at all. Code: RewriteCond %{REQUEST_FILENAME} !-f
(02-06-2015, 09:02 AM)CroNiX Wrote: This line is redundant: ohh, I didn't know this, thanks for the observation. |
Welcome Guest, Not a member yet? Register Sign In |