Wordpress Blog URL - wordpress

For some reason my blog posts are creating their own URL's.
Blog is on www.website.com/blog/ but when I make a new post, the new post URL is www.website.com/new-post-url/.
What I want is for the blog posts URL to be www.website.com/blog/new-post-url/ as their URL.
I use All in One SEO as my SEO plugin (if that matters).

You should check your blog setting.
login as administrator and go Settings >> General Settings
check here Site Address (URL). This should be http://www.website.com/blog
Hope this is helpful.
all the best ;)

#user1667462
Have you checked your .htaccess file?
Because you when you're having /blog kind of redirect to your WordPress Blog then you must have to add below code in your .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?website.com$
RewriteRule ^(/)?$ blog [L]

Go to Settings -> PermaLinks from Dashboard and select Custom Structure
give /blog/%postname%/
Check your blog by going to any post/page.

Log into your Wordpress admin panel and check to ensure that permalinks are set to the appropriate settings. Also check to make sure that your theme is not overriding the settings you might have chosen. Some themes for example can explicitly request you set a blog page for the blog posting which can interfere with what you assume to be happening.

Your go to admin page and click setting page, change the url types.

Related

How to modify URL Structure as per our requirement

As per the SEO standards, I want to modify my URL Structure.
For example :
I have a domain name
domain.com/blog/
on which I have installed WordPress.
Now while posting any blog I am getting my URL as
domain.com/blog/category-name/post-name
Now, I need to have my post URL as
domain.com/category-name/post-name
Similarly, for each category and its related post, I need to modify the URL structure as mentioned above.
Keeping in mind that my domain.com is developed on any other platform, and we have to modify WordPress installed directory/URL domain.com/blog as per our requirement.
Subfolder name coming in between domain name and category name while editing it with WordPress admin dashboard custom permalink.
Not having any idea about this URL structure modification.
Your help will be highly appreciated.
Thank You.
With ,htaccess
This should change domain.com/blog/ to domain.com/
RewriteEngine On
RewriteRule ^/blog/(.*)$ domain.com/$1 [L,R=301]
Install Wordpress directly to domain.com, instead of sub folder 'blog'. Then URL will work as expected.
Otherwise can simply use this plugin:
https://wordpress.org/plugins/permalink-manager/
The plugin works with all custom post types and taxonomies, as well as many popular third-party plugins.

Remove Old Permalinks?

I have a Wordpress website. I have changed my permalinks several times. All past versions of the permalinks I used are still working. If I type them into the URL bar, I am taken to the page WITHOUT the URL changing/redirecting to the new/current permalink.
Why aren't the old permalinks redirecting to the new one?
This is causing issues with Google reading duplicate content.
Example: .com/lightbulb .com/shop/lightbulb
The second URL is old, but still works when I type it in.
Shouldn't it redirect to the new one?
How can I remove old permalinks from being found by Google?.
Thanks in advance
I think the old permalinks is stored in the table postmeta with the meta_key of _wp_old_slug
If you wanted to clear all of the old slugs you could use this:
DELETE FROM wp_postmeta WHERE meta_key = '_wp_old_slug';
As you can see, Wordpress doesn't handle redirections when you change your permalinks structure. There is 2 ways to handle this, through:
The htaccess rewriting rules (manually editing the .htaccess file) depending on your new old/new permalinks structure. If .com/lightbulb is the new path and .com/shop/lightbul the old one:
Options -Indexes
Options -Multiviews
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RedirectMatch 301 /shop/lightbulb(.*) /lightbulb$1
# or
# RewriteRule ^shop/lightbulb?(.*) http://www.domain.com/lightbulb$1 [R=301,L]
</IfModule>
But if you want to redirect old permalink structure .com/shop/ to main domain your .htaccess rules will be:
Options -Indexes
Options -Multiviews
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RedirectMatch 301 /shop/(.*) /$1
# or
# RewriteRule ^shop/?(.*) http://www.domain.com/$1
</IfModule>
Permanent redirection is used for best SEO practices, redirecting definitively old permalinks to new ones, avoiding duplicate content, and telling search engines that your old permalinks have been moved definitively to new ones.
Redirection Wordpress free plugins (there is a lot):
Redirections plugin is the most popular and offer a easy-to-manage 301 redirections and 404 error tracking. It also offers more advanced tools to help you keep track of loose ends on your site like broken links and orphan pages.
Simple 301 redirects plugin is simple and deals with 301 redirect creation for when you’ve permanently moved content from one location to another.
Quick Page/Post Redirect plugin easily redirect pages/posts or custom post types to another page/post or external URL by specifying the redirect URL and type (301, 302, 307, meta).
Safe Redirect Manager plugin comes with an additional whitelist feature for added security…
SEO Redirection Plugin plugin offers support for generating 301, 302, and 307 redirects and also supports 404 error monitoring with easy one-click redirection…
Converting old path (urls) in database (if they still exist):
You can use Search and Replace free plugin, to easily find some old related urls or path in your database and bulk replace them by the new ones. This is a very powerful plugin, a little buggy, but working fine when you know it (but make always a backup before).
A recent reference:
A Simple Guide to Changing Your Permalinks Without Breaking Your WordPress Website
Why aren't the old permalinks redirecting to the new one?
Each time you add new permalink structure and flush rewrite rules, WordPress doesn't redirect old links to new links. Instead, WordPress will alter the old links with the new links completely.
All past versions of the permalinks I used are still working.
In WordPress, a URL doesn't map to route. It's looped through rewrite rules to find a match - a real URL which can be translated into database queries by parse_request method.
It means that if the old rewrite rules which match old links aren't removed. The old links still work.
How can I remove old permalinks from being found by Google?
Since they have been indexed by Google, I think permanent redirects is the best solution.
I assume you're using Apache, if not, please let me know.
In your case, just add following code before WordPress rules in your .htaccess file:
RewriteEngine On
RewriteRule "^shop/(.+)/?$" "http://example.com/$1" [R=301,L]

Wordpress. Rewrite url when on custom taxonomy

It's a wordpress site. I am using a plugin called media tags. This plugin create a custom taxonomy called 'media tags' to display media that has been tagged. The url for these pages are currently domain/blog/media-tags/results
I would like to remove the blog part only when on a media-tags page. So I end up with:
domain.com/media-tags/results
but the standard blog posts,categories & tags still keep the blog part of the url:
domain.com/blog/cat/post-title, domain.com/blog/cat, domain.com/tag/post-tag
Is this possible please?
I'm assuming you just need a snippet for your .htaccess file.
RewriteEngine on
# condition to avoid recursion:
RewriteCond %{REQUEST_FILENAME} !blog
# your rewrite rule:
RewriteRule media-tags blog/media-tags
When the server receives a request to domain.com/media-tags/results it will rewrite the target URL as domain.com/blog/media-tags/results.
I guess you will also have to configure your plugin to point the URLs to the root directory of your server. From the Media Tags plugin homepage:
You can also change this ‘/media-tags/’ URL parameter to something of your liking like ‘/gallery/’. To do this log into wp-admin and go to the Permalinks page under Settings. At the bottom of the page you will see the input field for Media-Tag. Simply enter your preference and update the page.

Moving Wordpress to another domain with different permalinks

I want to move Wordpress to another domain and also change the permalinks. So basically what I want is to move from: oldsite.com/PostId-PostName.html to newsite.com/PostName/
I know this can be done from .htaccess, but I don't manage to get it right. Can you please help me ?
This is how it can be done using Apache's mod_rewrite:
# Activate Rewrite Engine
RewriteEngine On
# redirect posts to new site
RewriteRule ^(\d+)-([^/]+)\.html http://www.newsite.com/$2/ [R=301,NC,QSA,L]
This will ONLY redirect URLs like oldsite.com/12345-very-interesting-post.html.
There is a Codex article dedicated to this: Moving WordPress

How to redirect a page in a site to another page in wordpress

I am trying to get a url to be redirected to another site.
For eg. www.abc.com/joe needs to be redirected to www.xyz.com/joe
where www.abc.com is a wordpress site.
thanks
Prady
You can do this at the web server level; WordPress isn't involved. Add to your .htaccess:
RewriteRule ^/?joe$ http://www.xyz.com/joe [R=301,L]
After the "RewriteEngine On" line that's already there because of WordPress.
You might find this answer I wrote over at SO's sister site WordPress Answers to be helpful. In short you can use PHP and a WordPress hook to do the redirection which keeps you from having to mess with .htaccess and gives you a lot more control over what happens as well:
Creating 301 Redirects for Post, Page, Category and Image URLs?
Hope this helps.
-Mike

Resources