I need help with my custom htaccess redirection. Those are my htaccess rules:

# AddHandler application/x-httpd-php .php .htm

  RewriteEngine on
  # 301 redirect to domain without 'www.'
  RewriteCond %{HTTP_HOST} ^mydomain.com$ [NC]
  RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L]

  RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC,OR]
  RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
  RewriteCond %{REQUEST_FILENAME} !/www\.mydomain\.com/public/www/
  RewriteRule ^(.*)$ /public/www/$1 [L]

  RewriteCond %{HTTP_HOST} ^(www\.)?cms\.mydomain\.com$ [NC]
  RewriteCond %{REQUEST_FILENAME} !/cms\.mydomain\.com/public/core/
  RewriteCond %{REQUEST_FILENAME} !/cms\.mydomain\.com/tmp/
  RewriteRule ^(.*)$ /public/core/$1 [L]

So everything from main directory is redirected to public/... Is it possible to not redirect one directory in main directory?

For example:

http://mydomain.com/something will redirect me to public/www/something but I want it point to root_folder/something

link|improve this question
feedback

1 Answer

Add this condition into your rule: RewriteCond %{REQUEST_URI} !^/something.

Your rule then should look like this, for example:

RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/something
RewriteCond %{REQUEST_FILENAME} !/www\.mydomain\.com/public/www/
RewriteRule ^(.*)$ /public/www/$1 [L]
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.