views:

32

answers:

2

Hi All,

I have created a front controller for my website. I want to pass all requests to the website through this front controller. Now I also have some other software installed in the web root and right now I am adding those folders to ignore via .htaccess so that their requests also don't go to front controller. I am doing something like below,


  RewriteEngine On
  RewriteCond $1 !^(folder1|folder2|folder3|robots\.txt)
  RewriteRule ^(.*)$ index.php [QSA,L]

This works for now, but is there a way to add requests only for specific domain or folder to get passed through index.php for Eg: www.mysite.com or www.mysite.com/folder4 or mysite.com.

This way I don't have to keep adding folders to ignore whenever a new one is created.

Thanks.

EDIT: I'll try and make it simpler. I want all the requests for one specific folder and main site to go through a front controller. Other than these, all requests should be processed as usual

A: 

You could use these conditions instead to exclude any request that can be mapped onto existing files or directories:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Gumbo
A: 

You can use the SERVER_NAME variable:

RewriteCond %{SERVER_NAME} ! ^(www\.)?mysite\.com$
Maurice Perry
Ok, what I want is if request is http://www.mysite.com then request should go through index.php controller. If request is http://www.mysite.com/folder1 then it should not go through any controller. The server name will be same, I just want to use controller for only some folders and main site not on all.
Harsha