I'm trying to add mod_rewrite rules in the vhost config but it's not working. For the site "mysite.com" I want to redirect "/webmedia/" to the home page .
Here is what I have:
<VirtualHost 192.168.100.142:80>
ServerAdmin [email protected]
DocumentRoot /home/drupal_1
ServerName mysite.com
ServerAlias www.mysite.com
Alias /movies /home/movies/
ErrorLog /var/log/httpd/mysite.com_err_log
CustomLog /var/log/httpd/mysite.com_log special
<Directory /home/drupal_1>
Options FollowSymLinks Includes ExecCGI
AllowOverride All
DirectoryIndex index.html index.htm index.php
# Rewrite Rules #####################
RewriteEngine On
RewriteRule ^/webmedia/(.*) / [R=301,L]
# end Rewrite Rules #################
</Directory>
<Directory /home/movies>
Options FollowSymLinks Includes ExecCGI
AllowOverride All
DirectoryIndex index.html index.htm index.php
</Directory>
</VirtualHost>
mod_rewrite is an Apache module that allows for server-side manipulation of requested URLs. mod_rewrite is an Apache module that allows for server-side manipulation of requested URLs. Incoming URLs are checked against a series of rules. The rules contain a regular expression to detect a particular pattern.
The term Virtual Host refers to the practice of running more than one web site (such as company1.example.com and company2.example.com ) on a single machine.
This should work if you have mod_rewrite loaded.
<Directory /home/drupal_1>
Options FollowSymLinks Includes ExecCGI
AllowOverride All
DirectoryIndex index.html index.htm index.php
</Directory>
<Directory /home/movies>
Options FollowSymLinks Includes ExecCGI
AllowOverride All
DirectoryIndex index.html index.htm index.php
</Directory>
<VirtualHost 192.168.100.142:80>
ServerAdmin [email protected]
DocumentRoot /home/drupal_1
ServerName mysite.com
ServerAlias www.mysite.com
Alias /movies /home/movies/
ErrorLog /var/log/httpd/mysite.com_err_log
CustomLog /var/log/httpd/mysite.com_log special
# Rewrite Rules #####################
RewriteEngine On
RewriteRule ^/webmedia/(.*) / [R=301,L]
# end Rewrite Rules #################
</VirtualHost>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With