Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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]
</IfModule>

After the addition of

NameVirtualHost *:80

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

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

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?

share|improve this question
1  
What are $uri, $tld and $domain? These domains are presumably intended to be separate (different .htaccess files etc)? –  w3d 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
add comment

1 Answer

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?

share|improve this answer
add comment

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.