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

[eluser]1ONE[/eluser]
Hello all,

I need some help with .htaccess
I have 1 admin controller and 1 web controller. I'm using this .htaccess :

Code:
Options -Indexes
Options +FollowSymLinks

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

Idea is to have htaccess rule which will automatically call web controller (example, now I go to www.some-page.com/web/function and I would like to go to www.some-page.com/function)

For this I can use this htaccess :

Code:
Options -Indexes
Options +FollowSymLinks

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

But then I can't access www.some-page.com/admin, because it redirects me to index.php/web/admin

I would appreciate any help.

With kind regards,
#2

[eluser]Phil Sturgeon[/eluser]
Quote:Options -Indexes
Options +FollowSymLinks

RewriteEngine on

RewriteCond %{REQUEST_URI} ^(/)?admin
RewriteRule ^(.*)$ index.php/$1 [L]

RewriteCond %{REQUEST_URI} !^(/)?admin
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/web/$1 [L]
#3

[eluser]1ONE[/eluser]
Hehe. Thank you! It is working Smile




Theme © iAndrew 2016 - Forum software by © MyBB