I have Redhat Linux server and I was using /var/www/html to display my site.

By using the following directive rewrite mod was working fine.

<IfModule mod_rewrite.c>
  # Enable mod_rewrite engine
  RewriteEngine on

  # WITH mandatory 'www.'
  #RewriteCond %{HTTP_HOST} ^$uri\.$tld$ [NC]
  #RewriteRule ^(.*)$ http://www.$domain$1 [L,R=301]

  # WITHOUT 'www.'
  RewriteCond %{HTTP_HOST} ^www\.$uri\.$tld$ [NC]
  RewriteRule ^(.*)$ http://$domain/$1 [L,R=301]

After the addition of

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domainmaster.example
ServerAlias domainmaster.example *.domainmaster.example
DocumentRoot /var/www/domainmaster

<VirtualHost *:80>
ServerName www.domainother.example
ServerAlias domainother.example *.domainother.example
DocumentRoot /var/www/domainother

URL rewrite doesn't work. Website files wasn't modified. .htaccess file redirects all traffic to index.php and index.php decides which page to display.

  • 2
    What are $uri, $tld and $domain? These domains are presumably intended to be separate (different .htaccess files etc)?
    – MrWhite
    Jan 23, 2013 at 8:49
  • i think it's for multiple domains support.
    – dtakis
    Jan 23, 2013 at 12:09

1 Answer 1


Where do you place the mod_rewrite directives that you have provided?

If you still have those directives in httpd.conf, then, perhaps, they fall outside of the VirtualHost directives, and have no effect on your vhost domains?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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