CodeIgniter Forums
htaccess issue - 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: htaccess issue (/showthread.php?tid=8599)



htaccess issue - El Forum - 05-23-2008

[eluser]AtlantixMedia[/eluser]
Hello,

I'm having problems getting a very simple htaccess rule to work.

Code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^http://www.domain.com/test$ http://www.domain.com/info/services
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

how come the first rule does not work and I get a 404 error?

thanks


htaccess issue - El Forum - 05-24-2008

[eluser]AtlantixMedia[/eluser]
anyone wants to take a shot at this? thanks


htaccess issue - El Forum - 05-24-2008

[eluser]Matthew Lanham[/eluser]
Hi There,

Maybe try changing

Code:
RewriteRule ^http://www.domain.com/test$ http://www.domain.com/info/services

to the same without the ^

Code:
RewriteRule http://www.domain.com/test$ http://www.domain.com/info/services



htaccess issue - El Forum - 05-24-2008

[eluser]AtlantixMedia[/eluser]
actually I already tried that. I tried several combinations, using (.*) as well. it's not working. is this the correct way to handle htaccess redirects from within CI?


htaccess issue - El Forum - 05-24-2008

[eluser]Matthew Lanham[/eluser]
The recommended .htaccess as in the user guide (http://ellislab.com/codeigniter/user-guide/general/urls.html)

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

I have never had a problem using this before...


htaccess issue - El Forum - 05-24-2008

[eluser]AtlantixMedia[/eluser]
that does not do what I'm trying to accomplish, does it? by the way, I have that rule and it works. the other rule doesn't. I will rephrase this. let's say you have test.js at http://www.domain.com/system/application/js/. you want to refer to that file by using this http://www.domain.com/js/test.js without actually changing anything in the file structure. how would you go about this? in other words, how do you mask system/application and reroute to it?


htaccess issue - El Forum - 05-24-2008

[eluser]Pascal Kriete[/eluser]
Try something along these lines:
Code:
RewriteEngine on
RewriteBase /

RewriteRule ^js/(.*)$ system/application/js/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]



htaccess issue - El Forum - 05-24-2008

[eluser]AtlantixMedia[/eluser]
that works wonderfully. thank you very much!!! can you tell me why you are using ^ before the pattern to look for? shouldn't that be used to define the very start of the pattern?