简体   繁体   中英

HTA redirect - mask URL

I'm having trouble redirecting my main website www.mydomain.com to the folder mydomain.com/stuff/public_html/index.html while retaining www.mydomain.com in the URL. I'd prefer to use HTA over some html solution, but what's the most SE friendly and modern solution for this?

I've tried the simple HTA 301 redirect below, but it shows the file path which I want to avoid.

RewriteEngine on

RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^/?$ "http\:\/\/www\.mydomain\.com\/stuff\/public_html\/" [R=301,L]

Thanks!

Looks like you do not need an external redirect. You need an internal redirect. For this you need to remove the [R] flag in your rule (and have only [L]). The [R] flag forces an external redirect with a HTTP 301 response code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM