regarding wordpress url structure rewrite - wordpress

I want to create user friendly wordpress pages url's.
I want to make url like this for example:-
http://www.example.com/234
here 234 is any integer number assigned by admin for the pages.
when i am trying to do this then it automatically adding -2 with the url's and also page with this url is not working.
Any help for this would be appreciated.
Thanks in advance.

Assuming that you have your .htaccess file correct, you'll have a -2 appended to the url in case you are setting a value which already exists for another post. Check your posts again to see if there's any post with that permalink (including posts saved as draft).

Related

Wordpress automatically appends a "2" to a URL. How can we remove this?

on a wordpress site we had created a subpage example.tld/landingpage/. After removing this subpage and adding it again, wordpress now automatically appends a 2 to the URL: example.tld/landingpage-2/. We would like to restore and use the original version without the 2 in the URL. The old page cannot be found in the trash. A contribution page or a category page with the same name does not exist. About the URL change function in the backend it does not work. How do I get this -2 out of the URL again? Do you have any idea what this could be and how we can fix the problem? Last possibility is to delete the page from the database. But I don't want to do that if possible. Many thanks!
Did you upload an image with the name of landingpage? Could you please check the URL example.tld/landingpage ?
And also see if there is a drafted page with that name.

Is it possible to automatically add a slug to an already existing URL once permalink structure has been changed?

I am running a website in which the different posts all have an associated category: let's say, news, reviews, videos, etc.. We want to change how URLs are generated to incorporate the category before postname.
I will put an example:
old url: https:///www.myweb.com/amazing-new-car (with category in the post being news)
new url: https:///www.myweb.com/news/amazing-new-car (with category in the post being news)
I know how to do this by changing permalink structure in the wordpress settings to /%category%/%postname%/ but the problem is that this is applied to older entries too so when i try to access https:///www.myweb.com/amazing-new-car it gives me a 404 error. The problem here is that we have links to parts of our site sent to people, social networks and so and if they use them they will see this 404 error.
I've tried to use Redirection plugin to create a rule that can redirect old URLs to new URLs but it does not work (i've tried even wildcard redirection).
My question is: is there any way to do what i want rather than individual renaming of the links?
Thanks in advance, i hope i've explained well my problem
WordPress has all the tools necessary to make this change happen, and typically it does successfully redirect the slug from /slug to /news/slug
If you have added a category and haven't touched permalink settings, this is probably your problem.
Once you add a new category or post type into Wordpress, you should go into the Permalink settings and just click save. No need to change the settings if you are happy with them...

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!

Duplicate wordpress pages - I need to strip the -2/ suffix from duplicate pages using .htaccess

Frustrating because it seems like it should be simple.
Client had a data snaffu and a lot of merged pages in Wordpress.
domain.com/king-2
domain.com/king
are the same page.
Client wants to redirect all the -2 pages to the non -2 pages
So:
domain.com/king-2 -> domain.com/king
How could i use .htaccess to set up a rule to do this for all -2 pages?
Thanks...
Why not fix the source of the problem rather than working around it?
You can run an SQL find-and-replace on post_name (in wp_posts) to fix your slugs.

Wordpress, two URLs for the same post

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.

Resources