How to change URL links that were made by WordPress? - php

I have a WordPress blog. All the post are currently in this convention:
http://www.myblog.com/blog/?p=1442
Now I'd like to change the URL of all posts like this one:
http://www.gomidjets.com/blog/this-is-my-post
While it's quite easy to apply it by changing the blog settings, the big problem is about the links I've placed
in many external website. I can't change them, and I'd like to map the old links to the new links somehow.
Do you know how to do it - if that's possible at all?
Do you have a better solution?
Thank you very much

Wordpress will map all old URL to new one, in case if you provided all URL in their original shape, such as http://example.com/?page_id=80
The answer is: you don't need to do anything.

I believe what you're looking for can be found in the admin panel.
In the admin panel (http://www.your-wordpress-site.com/wp-admin), go to Settings > Permalinks

Login to the admin panel first,
go for the settings->Permalink Settings
Select the format you want.
If you want change the base url for only some posts then you can edit from database.

Try this Redirection wordpress plugin to redirect your old url to your new url.

The URL's should resolve fine because the original URL you're using is the permalink one to my knowledge. If you're wanting end users to be redirected to this url, that's a bit harder.
That aside, I couldn't find any plugins that already did this. What you want to do is check the current URL against the wordpress function get_permalink() and if it doesn't match, redirect to the current permalink URL.

Related

Way to change the author permalink in wordpress?

I am currently viewing members details using author.php - it all works perfectly but i want to change the /author permalink to /member. Ive done this but it takes me to a 404 page now.
add_action('init','change_author_permalinks');
function change_author_permalinks()
{
global $wp_rewrite;
$wp_rewrite->author_base = 'member'; // Change 'member' to be the base URL you wish to use
$wp_rewrite->author_structure = '/' . $wp_rewrite->author_base. '/%author%';
}
Login and go to the dashboard.
Then go to Settings > Permalinks and save the page. That flushes the rewrite rules and should then take you to the correct page when entering the new URL.
You could also use flush_rewrite_rules() but you should use that function sparingly and only when you need to. Saving the Permalinks page is the easiest way to go so you're not flushing the cache constantly.
Great plugin: https://wordpress.org/plugins/edit-author-slug/
This plugin works great. but some things you can do without a plugin.
Here is a perfect solution without a plugin, check it out this article. It is working fine for me.
This plugin may help: https://wordpress.org/plugins/edit-author-slug/
I used on several sites and never had an issue ;)
Be sure to save your permalinks (Settings > Permalinks) after any slug update.
I actually just built a plugin to address this very issue. It allows you to change the author url to anything at all. It effectively changes the link shown on the posts, and also redirects any old author pages. Can be specified per user or globally.
https://wordpress.org/plugins/wp-custom-author-url/
Hope this helps!

how create a custom url in wordpress for page with slash like /se/pagename

I added a page in wordpress. Wordpress created a url like
https://mywebsite.com/page-title
but I want to change this url like https://mywebsite.com/se/page-title
My Permalink Settings shows https://mywebsite.com/sample-post/
and website is already indexed on google so I can't change my paramlink setting.
I also tried with htaccess and also from wordpress add_rewrite_rule() but no result is coming.
Any help how can I do this?
The simplest way to make your page url like www.example.com/se/se1 instead of www.example.com/se1 is to create page se and se1 make as child page of se.
With this option you'll saved your wordpress website permalink structure, you'll in not need to change your other pages redirects for google indexing

Custom Permalink with Page Name Wordpress

I have looked all over the place and can't figure out how to get this to work.
I want my urls for blog posts to look like this: "www.website.com/my-page/category-name/blog-post-title"
The issue I am having is that I have a page called "my-page".
So I have a page "www.website.com/my-page/" which is just a standard wordpress page, but I want the url for the blog post to look like it is under that page.
Here is what I have for the permalink so far:
/my-page/%category%/%postname%/
But this doesn't work and gets a 404 error when opening a blog post.
At this point I don't believe it can be fixed through the wordpress gui, so if anyone has any recommendations, it would be appreciated.
Thanks!
Edit: I wanted to add that the permalink works fine if I remove "/my-page" or if I simply modify it so it does not match the page.
First of all you should not use the category in front of your permalinks as it leads to bad performance (and some posts may have multiple categories): http://ottopress.com/2010/category-in-permalinks-considered-harmful/
The second thing is - it should work. I tried with a fresh installation on WordPress and I get the correct results.
Did you flush rewrite rules / save the new permalink structure?
Did you publish a post?
Is your server correctly configured to use permalinks?
Third possibility - if your permalink structure does not work for some reason you can define a custom permalink structure:
https://codex.wordpress.org/Rewrite_API

Permalink redirect issue in WordPress

My WP website is currently set to use the following permalink structure:
http://websitename.com/%postname%/
If I change that it to:
http://websitename.com/%year%/%monthnum%/%day%/%postname%/
everything works correctly. Specifically, older blog posts posted elsewhere (e.g. my FB page) redirect to the new URL automatically.
However, if I use a custom permalink structure and set it to the following:
http://websitename.com/blog/%postname%/
the redirect does not work on older posts. That is, I can still access all of the posts from the site, but if I linked to one of my blog posts on my Facebook page, for example, the old URL produces a 404 and does not redirect. I am thinking it has something to do with "blog" not being one of the variables that WordPress recognizes.
Any thoughts on why this is happening, and how to fix it?
Thanks in advance!
You can use wordpress quick redirect plugin for redirection
http://wordpress.org/plugins/quick-pagepost-redirect-plugin/
It is simple to use

clean urls in wordpress

Im using page.php in wordpress for making a dynamic page.
Right now Im using photography/?cat=portraits
But I want photography/portraits
Im currently grabbing whatever is in my query string (cat=portraits) and only showing that content.
Where at in wordpress can I set up the routes or permalinks to be formated more simple?
Permalinks can be found under the setting tab from your WordPress admin interface
Follow this tutorial...
http://www.creativecitrus.com/wordpress-development/how-to-get-pretty-urls-in-wordpress
Or theres the Pretty URL plugin....but Ive never used that
http://wordpress.org/plugins/pretty-url/
Login wp-admin
Settings -> permalinks and choose custom structure place this sting and save it
/%category%/%postname%
If you have any problem in saving permalink please copy paste it in htaccess.
Or make it write permission for period.

Categories