301 redirect in htaccess not working as expected - wordpress

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:
old blog post: https://www.horizonhomes-samui.com/horizon-homes-construction/
new page: https://www.horizonhomes-samui.com/construction/
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.

Related

301 Redirect from OpenCMS to Wordpress

I just migrated a website from OpenCMS to Wordpress as its platform. What Im trying to now is redirect the pages one by one using .htaccess found in the cpanel.
Question is how do I redirect this url https://www.southville.edu.ph/opencms/opencms/Southville/v2/Webpages/ContactUs/ContactUsForm.jsp
to here
https://www.southville.edu.ph/contact-us/
I've tried adding this code below in the .htaccess
Redirect 301 /opencms/opencms/Southville/v2/Webpages/ContactUs/ContactUsForm.jsp https://southville.edu.ph/contact-us
but it wouldn't work. This is my first time migrating a website. Hopefully you guys can help me. Thanks so much!

WordPress domain redirection

Beginner question:
I need to perform a 301 redirect from one Wordpress site (domain), to another Wordpress domain, like this:
From:
http://mycompany.com
To:
http://mycompany.se
A problem is that I have no FTP credentials for my From-site. I can't reach the .htaccess file.
Is there a plugin to use? I have studied the Redirection plugin, but this one seems working on pages within the same domain only(?)
I guess I need to be careful, because if some plugin edits the .htaccess file and something breaks, I can't reach the file...
Thankful for any help!
Whit Redirection Plugin you can redirect a url from old to new website.
You can create and manage redirects quickly and easily without needing Apache or Nginx knowledge. If your WordPress supports permalinks then you can use Redirection to redirect any URL.
There is full support for regular expressions so you can create redirect patterns to match any number of URLs.
The plugin can also be configured to monitor when post or page permalinks are changed and automatically create a redirect to the new URL.
You can easily find multiple plugins to perform 301 redirection in wordpress,but if you want to edit .htaccess you can install the plugin called "WP htaccess control" https://wordpress.org/plugins/wp-htaccess-control/ .
Through this plugin you can edit the .hraccess file from admin side.
Thanks.

301 redirections when migrating from Wordpress to Ghost

I want to migrate my WP blog to ghost, the permalinks have the same slug (/blogWP.com/title-article and blogGhost.com/title-article) but I still have pages such as blog.com/category for instance to redirect.
Is there any way to make 301 redirections in Ghost as I would do in a .htaccess file ?
Thx !
It's possible to redirect through ghost itself directly, but you need to alter the core. Though I'm not sure it's the perfect or proper way.
open core/server/errorHandling.js
find this line:
error404: function (req, res, next) {
Add below:
res.status(301);
res.set({'Location': 'http://your-new-wordpress-blog-url'+req.url});
res.send('301','Not found');
This way, Instead of showind 404s, I redirect to my wordpress' new domain (http://your-new-wordpress-blog-url in the example)
This way, www.ghost.url/not-a-valid-page will redirect to http://your-new-wordpress-blog-url/not-a-valid-page instead of showing the Ghost's 404 page.
p.s: This redirects, but I'm not 100% sure the headers are correct, I'd appreciate if someone else would clarify.
I'm sorry, but there is currently no way to do redirects with Ghost.
The best way to do redirects is to use a proxy server (recommended) and do the redirects there. For Apache you could use .htaccess files and nginx offers HttpRewriteModule.
My ghost blog is a subdirectory /blog/ runing with NGINX.
I needed to redirect old wordpress urls /blog/category/post-title to /blog/post-title
Except for /blog/ghost/.., /blog/tag/.., /blog/author/.., /blog/post-title/amp/.
So I came with that rewrite rule :
rewrite ^/blog/(?:(?!ghost|tag|author).).*/(?:(?!amp))(.+)$ /blog/$1 permanent;

301 redirect images directory

I've recently deployed a new Wordpress site that was replacing an existing site. So I've set up a whole bunch of 301 redirects in the .htaccess file.
I'm having troubles with one particular redirect though:
Redirect 301 /images/‎ http://domain.com/
I seem to have no trouble with any other redirects using exactly the same syntax. Could the 'images' directory be some sort of reserved word somehow? Not even sure where to start troubleshooting this!
Any ideas?

301 redirect vs. wordpress

I am getting really desperate over here.
In order to make up some SEO I want to redirect my none-www into www site. Of course simple 301 redirect ill d the trick, and it also work.
BUT
What doesn't work, at all, is a wordpress. I have my own VPS, and I am installing wordpress by application manager in plesk panel. But if i activate the htaccess file, wordpress cannot be installed anymore (strangely enough it tells me that mysql extension is not activated) and existing wordpress pages will stop orking with infinite loop error. Once I delete htaccess everything works fine.
Please if anyine has idea how can i redirect and have wordpress at the same, it would me much appreciated
Bypass the problem. Set up a simple example.com domain/site in Apache, and force it to unconditionally redirct to www.example.com. Wordpress would only be active in the www.example.com site's setup, and example.com exists ONLY to redirect to the www version.
That way you're not trying to get your .htaccess stuff to coexist with Wordpress', and the redirection occurs far outside of Wordpress' domain.

Resources