Wordpress Permalink Redirect "/%postname%/" to "/%postname%-%post_id%.html" - wordpress

We changed to our wordpress site's permalink structure from "/%postname%/" to "/%postname%-%post_id%.html". For example from "site.com/post" to "site.com/post-12345.html". We are using also AMP version of site and there are links' AMP versions like "site.com/amp/post-12345.html".
There are a lot of different examples with different variations of permalink redirect on internet. But we can not find a redirect way. As we understand it is not possible with htaccess. We tried a lot of functions.php codes that we finded from StackOverflow and other sites, but the redirect could not work. As we say there are a lot of examples on google but any of these is not the same to our permalink redirect structure.
We find some codes from a Chinese site about Scott Yang's Permalink Redirect plugin which is deleted from WP repository. The normally there is not a plugin version of this but we used these codes like a plugin. It has worked for some conditions. But for some link like AMP it gives error and plugin's settings are not stable.
How can we redirect our links correctly with amp and without any loop?

Related

magento fishpig wordpress integration - block view of non-magento blog site

I've gotten the 4.3.08 fishpig extension working with my 1.7 Magento site (yes, I know it's a very old magento version). The integrated blog looks great and has the magento theme when I access it via the Site Address URL. However, I can still access the non-integrated blog when I type the Wordpress URL into a browser. That url doesn't have the integrated theme - it's just the plain posts. I don't want google to index that wordpress url or for users to find that url. I want them to only see the Site Address URL. I have done a ton of searches but can't seem to find how to do this. Looking for help!
You haven't included your URL so I can't provide accurate feedback. That being said, if configured correctly, the WordPress URL should give a 404 error page. This won't be seen by anyone and won't be indexed by search engines.
If the WordPress URL is visible and everything is configured correctly, you may be using the default permalinks (eg. /blog/?p=123). Change the Permalink structure at Settings > Permalinks and the WordPress URL should generate a 404 page.

How to modify .htaccess file to rewirite https to specific pages and directories for WordPress site?

None of the answers i searched on Google and this site give me the correct answer. It was either because it wasn't for WordPress based platform or it wasn't for pages permalinks.
Anyway, my site using permalinks to get better SEO performance over the regular page ID names. I have one specific page that i want to secure with HTTPS (SSL Socket), a directory under /wp-content/themes/my-theme (/wp-sec), and of course the /wp-admin directory/folder and /login.php page. All the other pages should be HTTP even if i will try to write the link as HTTPS.
The specific page ID is 3519 (/?page_id=3519) and it's permalink is "test".
PLEASE, if you don't know and you are not expert don't answer this question.
Thanks.

Website Redirects but I did not allow it

I've setup a website using WordPress and just noticed that the homepage redirects to a different section of the website with random characters.
Like www.yourdomain.com redirects to www.yourdomain.com/XYiOEL which is a 404. It changes, sometimes it is there, sometimes it is not. I've checked my .htaccess (newbie here) and I don't see anything that could cause this.
Help?
See FAQ: My site was hacked « WordPress Codex and How to completely clean your hacked wordpress installation and How to find a backdoor in a hacked WordPress and Hardening WordPress « WordPress Codex and tell your host. Change all passswords. Scan your own PC. And see http://blog.sucuri.net/2011/08/timthumb-php-security-vulnerability-just-the-tip-of-the-iceberg.html

Migrating Wordpress Permalinks from postname to post_id/postname

My blog's been up for a year or so, and 90% of our traffic comes from Google, so I want to make sure that I'm handling this permalink change properly. I recently read on Wordpress' codex that including the numerical %post_id% at the beginning of your permalinks can greatly reduce the stress on your database, when a post or page is being fetched. So, I decided to change my permalink structure from /%postname%/ to /%post_id%/postname/.
Now, if I type in, or click on a link to my site in google that looks like this - http://blog.com/cool-post/, it seems to redirect to my new structure: http://blog.com/34424/cool-post/ without a hitch. I'm trying to figure out whether I need to use a 301 redirect plugin or not. I would like to think that search engines like Google will see the same "flawless" redirection that I'm seeing. There doesn't seem to be any broken links. Just looking to confirm that I'll be okay after this change.
Thanks
WordPress handles canonical redirects for you by sending 301 Moved Permanently status codes appropriately. That status code ensures Google will only index your posts by the new URLs (i.e. with the post IDs in your permalinks). I've not used a redirection plugin for a while and my sites have been indexed similarly just fine.

Wordpress: Two different Permalinks for same Blog

Is there any way we can have two different Permalinks in a Wordpress blog? This is because lot of us starts blogging when we have limited knowledge of SEO and end up in some URLs which are not that SE friendly.
Hence lot of pages from Blogs are already indexed by search engine and we do not want to spoil old URLs.
Thus I want to create new Permalink that is different than the old one. Only the newer post should use this permalink.
Is there any solution to this problem? Without 302 redirect we want to create 2 different Permalinks in the same Wordpress blog.
If I understand you correctly, you want to access the old posts only with the old permalink structure (e.g. ?p=123), and the new posts only with the new structure(e.g. /2009/08/name-of-article).
I'm afraid this is not possible without rewriting the Wordpress code (see short explanation at the end of my answer).
However, I think that Scott Yang's permalink redirect plugin (scroll down to FAQ) or Dean Lee's permalink migration plugin could be a solution.
Edit: both sites no longer exist. There are snapshots on Archive.com:
Scott Yang’s plugin, Dan Lee’s plugin.
These plugins are over 10 years old, however. The WP Redirect Permalink plugin might provide a similar service.
When Wordpress generates a link (e.g. for a new article, for "continue reading" links or for search results), it will use the new permalink structure, even for the old posts (which sadly isn't exachtly what you intended). If someone however uses an old permalink, it will be rewritten on the fly and the user (or SE) will be redirected to the correct page.
This 301 redirect should keep your page rank.
Explanation why having different permalink structures for old and new posts in parallel would mean changing Wordpress code:
For each post, Wordpress stores an unique ID (e.g. "123") and not necessarily unique post name (e.g. "name-of-article") in the database.
When an URL with a permalink like /2009/08/name-of-article is accessed, Wordpress translates this according to the currently configured permalink structure. If it constructs a link, it also does this according to the currently configured permalink rule.
You would need to add code toe Wordpress so that it uses two different rules depening on the age of the article.

Resources