• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mod_rewrite to a specific controller

[eluser]Phil Sturgeon[/eluser]
What am I missing here?

Quote:<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_URI} ^/([a-zA-Z0-9_-])$
RewriteRule ^(.*)$ index.php/profiles/redirect/$1 [L]

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

I bolded the part with the issue. The idea is that example.com/profilename goes to the controller, while example.com/something.html or example.com/something/somethingelse.html all go through to index.php. The problem is, my first rule is ignored.

Any ideas? It's late, I have been coding for almost 20 hours and I want to go to sleep...

[eluser]Pascal Kriete[/eluser]
You're only checking for one character.
RewriteCond %{REQUEST_URI}      ^/([a-zA-Z0-9_-]+)$ [NC]
RewriteRule ^(.*)$ index.php/profiles/redirect/$1 [L]

[eluser]Phil Sturgeon[/eluser]
HA! thanks very much Pascal, worked a treat.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.