Htaccess quick question
I am changing the domain associated with the site and want to know if I can configure htaccess to create the following types of redirects:
Redirection http://www.oldomain.com/contact-us
until http://www.newdomain.com/contact-us
Basically a global redirect that redirects to the new domain but saves the rest of the URL that the user typed.
UPDATE: I ended up using the following code and it works great
Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.olddomain.com$ RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
, , RewriteEngine. (RewriteEngine , , , - .)
Redirect permanent / http://newdomain.com/
Redirect -, , . Redirect :
:Redirect /service http://foo2.bar.com/service http://myserver/service/foo.txt, http://foo2.bar.com/service/foo.txt.
:Redirect /service http://foo2.bar.com/service
:
Redirect /service http://foo2.bar.com/service
http://myserver/service/foo.txt, http://foo2.bar.com/service/foo.txt.
http://myserver/service/foo.txt
http://foo2.bar.com/service/foo.txt
.
RewriteEngine on RewriteCond %{HTTP_HOST} ^oldname\.com RewriteCond %{REQUEST_URI} ^oldname\.com RewriteRule ^(.*)$ http://www.newname.com/$1 [R=301,QSA,L]
Batfan,
httpd, , NameVirtualHost httpd.conf. . http://httpd.apache.org/docs/2.0/mod/core.html#namevirtualhost
By default, httpd is not configured for name-based shared hosting. You must enable this through NameVirtualHost. Then try doing the redirects, as suggested by Greg Hugill.
Let us know if this works.
Thank Ismael Kazimpan
Source: https://habr.com/ru/post/1785694/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1785689/how-to-pass-variable-number-of-args-to-a-variadic-function&usg=ALkJrhhcNHT6wflN_v8lQY86OBTtdiwYTgHow to programmatically get iTunes settings to search for audio libraries? - cocoaReading EUC HTML using Java on Windows - javaBuild sphinx4 with eclipse - sphinx4Android Depth Buffer Problem: Recommendations for Anyone Having Problems - androidC #: implementing an interface with a property of any type - c #Самый быстрый способ сделать BDD/TDD в Rails? - performanceHow to deal with Final Strings? - javaDrag and Drop ListBox for WPF - .netHow can I display random blog posts by preferring high-rated posts? - databaseAll Articles