Welcome Guest, Not a member yet? Register   Sign In
htaccess issue
#1

[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
#2

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

[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
#4

[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?
#5

[eluser]Matthew Lanham[/eluser]
The recommended .htaccess as in the user guide (http://ellislab.com/codeigniter/user-gui.../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...
#6

[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?
#7

[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]
#8

[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?




Theme © iAndrew 2016 - Forum software by © MyBB