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.com
ServerAlias domainmaster.com *.domainmaster.com
DocumentRoot /var/www/domainmaster

<VirtualHost *:80>
ServerName www.domainother.com
ServerAlias domainother.com *.domainother.com
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.

Any ideas?

  • 1
    What are $uri, $tld and $domain? These domains are presumably intended to be separate (different .htaccess files etc)? – MrWhite Jan 23 '13 at 8:49
  • i think it's for multiple domains support.I just put this code and my site was working perfectly (as long as i didn't add the virtual hosts directives). Without (and my site was located to /var/www/html) <VirtualHost *:80> ServerName www.domainmaster.com ServerAlias domainmaster.com *.domainmaster.com DocumentRoot /var/www/domainmaster </VirtualHost> every call on domainmaster was returning user to root but index.php couldn't get the path (like the server redirected the user back to root (not the .htaccess file). With the addition all domains are like there is no mod_rewrite enabled for them! – dtakis Jan 23 '13 at 12:09

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, privacy policy and cookie policy

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