apache - Redirect all URLs to a single page in the httpd.conf -
i looking way redirect entire website 1 single domain. want in httpd.conf file. example virtualhost have looks like:
<virtualhost xx.xx.xx.xx> servername website.com serveradmin webmaster@website.com scriptalias /cgi-bin/ /usr/local/apache2/htdocs/cgi-bin/ documentroot /usr/local/apache2/htdocs/website customlog logs/website/access_log combined errorlog logs/website/error_log redirect / http://newwebiste.com redirect /xxx http://newwebiste.com </virtualhost>
currently redirects above still keep full url.
so if want http://webiste.com/test/thispage.html redirect http://newwebsite.com/test/thispage.html. want go newwebsite.com , lose rest.
so..
http://webiste.com/test/thispage.html
to
what need add httpd.conf achieve this?
thanks,
as have noticed redirect catches , sends same uri target don't want, use redirectmatch, match possible requests, not adding target url.
so can use:
redirectmatch ^ http://newsite.example.com/
as side note mod_rewrite: not recommend mod_rewrite recommended others unless have task @ hand requires complexity mod_rewrite can offer, , not case.
side note 2: examples better use "example.com" domain name since not valid domain , permanently reserved example purposes.
Comments
Post a Comment