How to modify URL Structure as per our requirement - wordpress

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.

Related

Redirect /123/POST to just /POST in wordpress using .htaccess Rewrite Rules

I have a website running wordpress with some good amount of posts.
For a specific reason, i setup my wordpress permalinks structure to /%post_id%/%postname%/
Now i want change my permalink structure to /%postname%/ for supporting a plugin Category Subdomain Pro
When i change the change the permalink structure, new links are working but i am getting a 404 error for old urls.
So, i am thinking about redirecting old urls to new urls.
If you know anything about this, please share something and help me resolve this issue.
Sorry for delay, Check this out... Before # BEGIN WordPress in .htaccess file put this code...
Redirect 301 /post_id/postname/ http://example.com/postname/
just replace post_id,postname to your website posts id and post name. Replace example.com with your website name and postname with your postname.
replace for every single post
or you can use plugin Redirection

Rewrite Magento url to Wordpress page

I have a Magento site installed at the root of my domain and a Wordpress installed in a subdirectory. Currently I access my sites like this:
Magento: "domain.com"
Wordpress: "domain.com/blog"
I would like to be able to use Wordpress Pages seamlessly, without the "/blog" subdirectory showing in the url, such as:
Wordpress Page-X: "domain.com/page-x"
Note that I do want to keep the "/blog" subdirectory showing normally for blog posts etc... I just don't want it for Wordpress Pages.
Could anybody help on how to set that up? I was think tweaking the .htaccess would've work, but I can't find out how. Other solutions are welcome too. Thank you.
Magento provides you with an option to create custom URL rewrites in the backend (admin) you can find it here. This way you should be able to create rewrites. Also if you want to automate the creation of rewrites you can refer to the core_rewrites table in magento's database. Also this is a good read if you want to do logic based rewrites on the fly.

URL Rewriting in Wordpress htaccess

I've built a Wordpress site that has a product page which retrieves product info from an external system using the querystring id passed in. So www.domain.com/product/?id=n loads the Wordpress product page which then loads the product info using the id.
This works fine.
However, I want to rewrite this URL so that:
www.domain.com/product/productname/id retrieves www.domain.com/product/?id=n
When I add the following to htaccess, the page returns a 404 because it doesn't exist in Wordpress.
RewriteRule ^product/productname/(.*)$ ^product/?id=$1 [L]
Does anyone know how to write this rule in such a way that it doesn't get hijacked by Wordpress rewriting?
After doing some additional searching, I've found some links that may help you get started. The secret lies in WordPress's add_rewrite_ruleshook. Haven't tried these myself yet, but looks promising:
http://codex.wordpress.org/Rewrite_API/add_rewrite_rule
URL rewriting via Wordpress Rewrite or .htaccess
http://www.hongkiat.com/blog/wordpress-url-rewrite/
http://matty.co.za/2009/11/custom-url-rewrites-in-wordpress/

Change permalink structure with htaccess - wordpress?

I want to change my old domain name to new domain. What I ask here is how to redirect permalink structure with htaccess from
http://www.OldDomain.com/postname/ to http://NewDomain.com/postid/postname/
/%postname%/ /%postid%/
Straight answer is NO, you must not do this via .htaccess.
Wordpress already supports (and enforces) this permalink structure so it is much better and cleaner to goto Wordpress admin panel and change the permalink structure to /%postid%/%postname%/ in the newer installation of Wordpress.
PS: Note that even if you rewrite these URLs differently via mod_rewrite, WP will enforce and expect this to whatever is defined in it permalink definition.

Wordpress Blog URL

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.

Resources