简体   繁体   中英

How do i stop htaccess redirecting loop

i am trying to redirect /article/1 to /article/1/title-of-blog using this htaccess line

Redirect 301 /article/1 /article/1/title-of-blog

when i do that my new link will be

https://www.mysite,com/article/1/title-of-blog/title-of-blog/title-of-blog/title-of-blog

as this loop keep going

so how to fix this problem

thanks in advance

Is /article/1 the end of the URL you want to redirect?

If so, use $ to indicate that this is where the URL ends.

ie. RewriteRule /article/1$ https://example.com/article/1/title-of-blog [R=301]

To fix this, the destination should be a full URL. This will look something like:

Redirect 301 /article/1 http://yourdomain/article/1/title-of-blog

For example, if your domain was example.com, you would have:

Redirect 301 /article/1 http://example.com/article/1/title-of-blog

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