Wordpress: Redirect URL Issues - wordpress

I understand that wordpress automatically redirects your url from non-www. to www. However, since I have strict SSL (HTTPS) enforced, it causes TWO redirects when a visitor enters "example.com" - i.e. it redirects from "example.com" > "http.://www.example.com" > "https://www.example.com"
Normally this isnt really a concern but when this happens, the TTFB becomes so much longer and nothing loads up except a blank screen.
Please help and advise what can be done to make it a 1 layer redirection from non-www to https://www.
Thanks!

This is probably an issue of combining something you've put in your htaccess and Wordpress's settings.
In Settings > General set both URLs to https://www.yourdomain.com. This should cause only one redirect, and will apply to the whole site. You shouldn't need anything else in your htaccess if this is set up.
If you need https only on certain pages, then that would need to instead be handled in htaccess or a plugin.

Related

Need wildcard 301 redirect for WordPress on IIS

I'm running a WordPress blog on IIS. I currently have the permalinks for the articles set to:
/%postname%/%year%-%monthnum%-%day%/%hour%:%minute%
So a sample article would be, right now:
https://example.com/headline-here/2019-02-11/15:45
I now want to change the permalink URL to not have the time at the end, which I can set up in WordPress just fine. In fact right now if you go to
https://example.com/headline-here/
It actually works without changing anything.
However, when I change the permalink in WordPress, the old links with the time at the end no longer work. This is a problem for Google, since it'll see my whole indexed site as 404 page not found errors.
I want to put in a single rule in Web.Config that will redirect:
https://example.com/[ALL-HEADLINES]/* (anything after the headline being the "*")
To:
https://example.com/[ALL-HEADLINES]/ (basically redirecting as a permanent 301 when someone/Google links to the previous URL with the time) To be clear, if someone goes to:
https://example.com/headline-here/2019-02-11/15:45
They're automatically redirected to:
https://example.com/headline-here
Can I do this in Web.Config? Or can I do this in WordPress (I've tried, I think not).
I don't want any 404 errors. I want them all to be 301 permanent redirects.
Is there a simple way to do this?

WordPress will not force SSL for the life of me

Hate to complain but I've spent like 2-3 hours working on trying to secure my WordPress site via SSL. I can successfully browse to my site via HTTPS, but I always get mixed content. I've tried several plugins, but there are still resources that are pulling images via HTTP. If I tried to browse to the URLs of those images manually, my web browser actually switches the URL to HTTPS, so I'm not sure why the site loads the images under HTTP but browsing to the images manually forces it over HTTPS. Very Confusing.
I've tried adding this in the .htaccess file of my root directory, so that all requests to the subdirectory /wp-content/ are forced over HTTPS, but it still does not work:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(wp-content/.*)$ https://www.example.com/$1 [R=301,L]
When I add this into the .htaccess file, reload the site, inspect element, I still see numerous links in here with http.
I've also tried HTTPS Easy Redirection, which forces HTTPS on everything but then results in a redirect loop. Still no luck.
Any suggestions would be greatly appreciated. It seems to just be the images.
What you have setup so far works, but does not address the root issue. As a matter of fact the .htaccess redirect is overkill.
Your Wordpress configuration needs to be edited. Go to your settings>general, ensure that the Wordpress Address Url and Site Address Url are https. It's that simple. You also need to edit any hard coded content urls to https.
You could use some wacky plugin to mutate your links but I would not advise it. But it won't work all the time. That will depend on how your content is constructed.
If you want to play it safe, whenever your add a resource link to content simply omit the protocol like this: ://example.com/.... That scenario works well with content generated by Visual Composer and the likes.
If the SSL is successfully installed in your server then use this plgin: https://wordpress.org/plugins/really-simple-ssl/
This will works for you...
Note: Take backup of your website and database first then proceed with the above plugin.
Thanks

How can I redirect from a Permalink to a new permalink?

To add more detail, my current situation is that we are moving from Symfony2 to Wordpress (resources choice). Usually the redirect would require a relative link as source and a permalink as destination.
Let's call the domain http://example.com
Users with old links such as http://example.com/article/[id] need to be redirected to the new urls which is something like http://example.com/title
We have around 200 links that require redirecting and as you can see the new urls don't allow much for automating the process. My issue is if we set the .htaccess under the old installation and change the domain for it to example2.com, none of the users will ever stumble on it to be redirected.
Which leads me to ask if its possible to have a permalink on both ends of the redirect. I am open to any other suggestions to how to tackle the issue, except the old and new url formatting can't be changed in the current situation.
It might not be the most efficient way of doing it but, I get a list of all the links I need to redirect and a list of the new urls they are directing to and do a 301 redirect in the htaccess. This will change all indexes on google so they will show up without any issues.
Redirect 301 /article/1 /title

Website is showing infinite redirect loop

I have a redirect issue on the website
The dmhdubai.com page isn’t working
dmhdubai.com redirected you too many times.
It was run on cloudflare then i changed the nameservers new server and changed back to the original nameservers .
What can be the problem?
#info, it appears your website dmhdubai.com is not stuck in a redirect loop. You'll need to clear your browser cache to remove any past redirects caused by previous directives.
You can check your website's redirect route at www.wheregoes.com/retracer.php.

HTTPS to HTTP redirect via .htaccess

I have a website hosted on a GoDaddy wordpress hosting. We had an SSL, but not longer have the SSL. Google archive some pages with the SSL so I just want to redirect https requests to the http version of the sit.e I have access to the .htaccess file so I figured that was the best way to do it.
I have been searching around and tried tons of different .htaccess redirects, but none of them are working. Including this https to http 301 redirect via htaccess. I know the htaccess is functioning because wordpress is working and I added a few test redirects to it and they worked as well.
Any thoughts or suggestions would be much appreciated.
Thanks.
Wordpress has its own redirect procedure.
Check in the General Settings of you WP Panel for the WordPress Address and the Site Address fields. Make sure they both are non ssl absolute paths.
Another thing to check is on the wp-config.php
define('FORCE_SSL_ADMIN', true);
That could have been added by another plugin. Remove it or make it false.
One last thing you could try (not the best option) is to ask google to remove those specific links, here's a reference for that.
I hope this helps.

Resources