Wordpress, two URLs for the same post - wordpress

Is it possible to have two URL for a same post in wordpress.com?
One would be a short URL like
http://mydomain.com/28
and the other will be a SEO friendly one:
http://mydomain.com/28-this-is-the-post-about...
thanks

In wordpress, all posts are at the URL mywordpresshome.com/?p=xx where xx is the post ID number. Anything else involves mod_rewrite. WordPress will do one type of rewrite for you in the Admin section -- so you can pick either the short version or the long one above. In the Admin interface, it won't let you do both. But you could edit mod_rewrite yourself and effectively get both patterns -- short and long -- to work.
Here's info on mod_rewrite: http://www.workingwith.me.uk/articles/scripting/mod_rewrite

In the Settings->Permalinks part of the admin panel, you can set the look of your permalinks, but that doesn't mean the default dynamic links (yourblog.com/?p=5 or whatever) will stop working. You can use those links too and they will take you to the corresponding page. However, Wordpress will automatically substitute the dynamic link by its SEO-friendly alias.
I'm not sure whether it's possible to have two different aliases for the same post though.

Related

How to bulk redirect URLs in wordpress site?

All my webpage URLs are structured as https://example.com/post-name/ in my wordpress website. I'd like to include category in URLs using permalink so all URLs will be look like https://example.com/category/post-name/. This will be a big threat for my SEO.
Is there a way to bulk redirect all my https://example.com/post-name/ URLs to https://example.com/category/post-name/?
Your best bet is to use a bulk export tool that will give you the permalinks of all posts in a CSV. We use WP All Export and it works beautifully for this.
The below instructions help you easily create individual redirects for a large number of posts. We've mapped thousands of posts for a move within minutes using this technique.
Step 1: Export all posts
You should end up with a CSV that has all the permalinks in this format...
/blog-post-title/
/another-post-title/
Step 2: Add destination column
Duplicate the permalink column and add the category slug (easiest way to prepend is with something like Notepad++)
You will end up with column B like
/catname/blog-post-title/
/catname/another-post-title/
*NOTE:*If you are adding in several categories like /catone/ /cattwo/ then you'll want to make sure your export had another column that included the specific primary category of a post and add that in to the below concatenation.
Step 3: Concatenate the two columns into a single column
You will take the result and add to your .htaccess file.
The spreadsheet equation will look something like:
="Redirect 301 "&A1&" "&B1
And the result will be:
Redirect 301 /blog-post-title/ /catname/blog-post-title/
Step 4: Launch new scheme
Place the redirects you generated into your .htaccess file but do not save.
Go to Settings>>Permalinks and change your permalink scheme to include the category.
Save permalinks and save the new .htaccess file.
Flush any caches.
Do some tests to make sure the redirects are working right.
Done!
I understand your question that you want to redirect URL of your post. The plugin that will help you in doing that is called Redirection. It is so easy to use and allow to add Bulk URL Redirections.
I was adding about 3 dozen redirects to a new website I recently built, I wasted a ton of time trying to do it one by one, when I got half way through I realized that there are multiple plugins that allow you to do this in bulk. All you've got to do is search redirect in your wordpress plugin section. Super simple and it will save you alot of tediousness and stress. Good Luck!

Achieving flat URL structure with woocommerce for SEO

In an attempt to make a multilingual woocommerce website with a flat url structure we thing would be best for our store's seo, we tried every combinaison plugins/features/sustom code/htaccess we know and could not make it happen.
I know WP suggests NOT to remove the base slugs from urls but the main reason is to avoid conflict between slugs and we intend on writing ALL slugs manually.
So, in short lets says we have categoryA and categoryAB (child of A) and a productnamedsomething associated to categoryAB.The usual URL of woocommerce would be:
www.domain.com/product-category/categoryA/categoryAB/productnamedsomething
while we would simply want:
www.domain.com/productnamedsomething
up to there, the WP htaccess Control plugin was working wonderfull, but adding multilangual fonctionnality made it complicated.
We tried both polylang and WPML and could not achieve in any way our target URLs:
www.domain.com/productnamedsomething
www.domain.com/fr/unproduitquelconque
However, typing any of these URL in the address bar works and displays the product, without the category tree. But we cannot get menus, category menus and other links to point to a flat url structure.
So the main points here are:
Did anyone succeed in creating flat url structure in woocommerce and what was the wining combinaison of plugins/hack used?
If not, what would be the best way to go about it, manually removing categories using htacess or maybe overwriting theme functions to change widgets and menu links structure in php?
Is all this worth the hassle or is woocommerce's basic url structure
better than it feels for a shop's SEO?
Ask clarifications if needed, i'll be glad to discuss this.
Have you tried the WordPress rewrite API? https://codex.wordpress.org/Rewrite_API

WordPress URL structure logic, how two different urls point to same content?

I have noticed that after rewriting URL in a WordPress site, I can reach the same content using two URLs:
http://example.com/category/article-name-here/primary_key
as well as
http://example.com/category/article-name-here
Both of these URLs will point to exact same content. What is the exact logic behind it, is the article name is in itself unique?
I am creating a startup site which will have the same URL structure. But I cannot have same unique-article-name.
Check this article out:
http://codex.wordpress.org/Using_Permalinks
It says
In the Settings → Permalinks panel (Options → Permalinks before WordPress 2.5), you can choose one of the "common" structures or enter your own in the "Custom structure" field using the structure tags.
Wordpress uses something called a router, which is also part of many frameworks, particularly MVC frameworks, to determine what content to show based on the URL. For example, it might look up something in the database (e.g. old pages that have been renamed), then show the content based on that, or it might only look for a file on the server and then show a 404 page if it doesn't find it.
Basically, look into routing as it relates to PHP frameworks to see how that whole logic works.

Set the permalink to any domain in Wordpress

Is this possible to achieve without too much effort or a plugin? It's simply to instantly redirect to a site I've made in my portfolio if the post doesn't have any content.
Note that I don't want a script in the actual post to redirect since I only use Wordpress as the backend and fetch all the data to be used by a JavaScript backbone app.
EDIT : Added some extra info in a comment
Short Answer: No. You cannot set your Post Permalink to an external asset without directly editing the database.
Long Answer: First off, you need to understand the purpose of the Permalink. It isn't just an arbitrary link to somewhere. It's reserved specifically for storing where that specific post lives within the context of your Wordpress installation.
Your post doesn't live on example.com. It has its own ID, and Wordpress has a specific spot set aside for it where it can be seen on YOUR domain. Leave it as such.
Instead, what you should be doing is employing the tools Wordpress gives you to achieve what you want. A Plugin doesn't exist for what you want because - quite frankly - it's a fairly trivial task when approached CORRECTLY and doesn't warrant the use of an external resource.
So what's the correct way?
Use a Custom Field. Name your Custom Field something like 'externalHref' and fill that in with your link to the website you want to point to in case there's no post content.
Then in whatever templates you're using to generate your posts, just check either for the existence of your Custom Field called 'externalHref' or check for the non-existence of Post Content. In either case, instead of generating a link using The Permalink you can simply build a link that points to wherever you need.

How to change default post url in Wordpress?

not sure how to get around this one. Anyways so I am working on a WP blog http://athenasweb.com
However every post I make the url is not athenasweb, but instead 1and1's default URL before the domain name was switched over:
http://s433108212.onlinehome.us/
This is really annoying especially when linking to new posts, anyway to change this in wordpress?
Example this: http://s433108212.onlinehome.us/aspectarian-nov-2nd-nov-8th-2012/
Should be http://athenasweb.com/aspectarian-nov-2nd-nov-8th-2012/
Go to general settings and make sure the wordpress address and site address match what you want it to be.

Resources