• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need help with .htaccess


I wrote a CI app, and now it's time to make it work. The app is divided to controllers that have functions. Now if I want to access a controller's function I have to do this:
Now to make this google friendly I tried to write a .htaccess file, which rewrites the urls so that each function has a specific name that is translated. For example:
translates to:

but this wouldn't work. I tried to debug it by redirecting the url (using [R]), and that way it did work, but without that it doesn't.

Here's the .htaccess code:
RewriteEngine on
RewriteBase /

#if the url starts with /name1/...
RewriteCond $1 ^(name1)
#then replace it with /controller/function1/...
RewriteRule ^(name1)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ controller/function1

#if the url doesn't contain index.php, css, design, pics, robots.txt, license.txt at the beginning
RewriteCond $1 !^(index\.php|css|design|pics|robots\.txt|license\.txt)
#then precede the url (containing any character) with /index.php/
#this will be the last transform, as previously we made sure that the nice urls are understood
#RewriteRule ^(.*)$ /index.php/$1 [R,L]
RewriteRule ^(.*)$ /index.php/$1 [L]

what am I doing wrong?

Messages In This Thread
need help with .htaccess - by El Forum - 07-16-2012, 03:11 AM
need help with .htaccess - by El Forum - 07-16-2012, 05:27 AM
need help with .htaccess - by El Forum - 07-16-2012, 06:13 AM
need help with .htaccess - by El Forum - 07-16-2012, 06:17 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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