Hi all, another noob question from me Can anyone tell me the Apache directive to setup a redirect so that when i call http://www.mydomain.com it goes straight to http://www.mydomain.com/home Thanks. Im also using another directive so can you tell me if i have to place it after this code or embed it within the same section. Current directive in place is: <Directory "/var/www/web1/web/files"> Options Indexes MultiViews FollowSymLinks AllowOverride All </Directory> Thanks for your help.
I tried the examples listed at that location i.e. ------------------------------------------- <Directory "/var/www/web1/web/files"> Options Indexes MultiViews FollowSymLinks AllowOverride All </Directory> RewriteEngine on RewriteCond %{HTTP_HOST} ^www.mydomain.com [NC] RewriteRule ^/(.*)$ /home/$1 [L] ------------------------------------------- Adding these directives totally messed the site up and gave the public access to read all different types of data stored for ispconfig and more. Is this a security bug? Anyway it did not do what i needed it to do. The RewriteRule i changed to /home as thats where i wanted "www.mydomain.com" to be re-directing to when someone calls www.mydomain.com or mydomain.com Any quick answers to this would be appreciated. Thanks.
redirect for your web to other URL To forward a co-domain you can just add a new hostname and domain name to forward to. To forward your domain itself to another URL, you can paste the following to the Apache directives field of the site: RewriteEngine On RewriteRule /.* http://www.example.com/ [R] Where http://www.example.com/ is the domain to forward to.
I would add Code: RedirectMatch permanent ^/$ http://www.mydomain.com/home/ @others: Why use complex rewrite rules, when you can use simple redirects?
Thanks Hans but your code did not work. but The code Grey supplied did work. Cheers to the both of you for helping.
Nice to hear that you find a solution. The code: RewriteEngine On RewriteRule /.* http://www.example.com/ [R] Works for me, i use it for quit a lot of sites.
I think it could work for him, too, but not every Apache installation has mod_rewrite loaded and enabled - perhaps that's his problem. But as I said above I try to use the simplest solution and mod_alias is very common and loaded most of the time