简体   繁体   中英

301 Redirect via htaccess

I'm trying to make 301 redirect via htaccess

Redirect 301 /page_one http://site.com/

But this code also redirects every children link of /page_one

For example it also redirects site.com/page_one/article to site.com/article

How to make 301 redirect exactly from /page_one to site.com/ ?

The Redirect directive uses prefix matching as illustrated in the following example:

 Redirect /service http://foo2.bar.com/service 

If the client requests http://myserver/service/foo.txt , it will be told to access http://foo2.bar.com/service/foo.txt instead.

Try using RedirectMatch :

RedirectMatch 302 ^/page_one$ http://site.com

Change 302 to 301 after testing. And may be you need to remove the trailing / .

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