: How to redirect and keep the previous URL with .htaccess? I have created a subdomain and want to redirect it to a URL. But I want to keep the subdomain as the URL of the redirection. I
I have created a subdomain and want to redirect it to a URL. But I want to keep the subdomain as the URL of the redirection. I have searched for it but none of them worked for me!
Subdomain: sub.domain.com
New URL: 10.10.10.10:8080
.htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.sub.domain.com$
RewriteRule ^/?$ "http://10.10.10.10:8080" [R=301,L]
More posts by @Berryessa370
1 Comments
Sorted by latest first Latest Oldest Best
You have a few fundamental problems with your last line.
RewriteRule ^/?$ "http://10.10.10.10:8080" [R=301,L]
Change it to:
RewriteRule .* 10.10.10.10:8080 [R=301,L]
Of course, I assume that the IP address 10.10.10.10 in your example is just an example and that you are not trying to redirect to a private IP address that is not routable. As well, port 8080 is not an HTTP protocol and that you do have a web server answering that port.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.