Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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