简体   繁体   中英

301 redirect in htaccess not working as expected

I am trying to add a simple 301 redirect to a website's htaccess, but no redirection is occurring, nor am I encountering any errors--can anyone shed some light? The redirect would redirect people visiting an old blog post to a new page:

The redirect code I'm using is:

Redirect 301 /horizon-homes-construction/ https://www.horizonhomes-samui.com/construction/

Possibly Relevant Info

  • My site is a Wordpress site.

  • I also tried adding a "RewriteEngine On" line to the top, but that did not resolve the issue.

  • The htaccess file I'm editing is located in my WordPress root directory (along with wp-content, wp-admin, index.php, etc).

  • The instructions I'm following for adding the 301 redirect are from this guide .

Thanks.

When you don't have a lot of control over the server, which is the case for a lot of wordpress sites, a plugin is better than trying to update the .htaccess file.

I am sure there are a lot of good plugins that do this. This one has worked for us. https://wordpress.org/plugins/redirection/

With the help of my server admin, I ascertained why this 301 redirect was not working. It is because my site is on an Nginx server, so any redirects added to htaccess will not be read by the server. My server admin was able to add the redirects properly.

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