rmuller
rmuller

Reputation: 1837

Change wordpress post url (remove subdomain)

I have a Wordpress blog installed in a subfolder and I would like to replace a part of the url of the post.

Right now it is like this: http://domain.com/wordpress/{permalink-structure}

What I would like to achieve (without moving the site) is: http://domain.com/{permalink-structure}

I tried changing the site url (and followed the instructions provided by WP on how to do this), but if I do this, my front-end stops working ( I am not retrieving the posts etc through the WP-API and I work with AngularJS)

Is there an easy way to automatically modify the (by wordpress generated) url of all future posts by using a plugin or modifying the source code? Or via .htaccess?

Redirecting via htaccess is my preferred option but when I tried this, the wp-api plugin (accessible via domain.com/wordpress/wp-json/* stopped working

Just to be clear: I am not accessing the posts by the generated URLS, I retrieve them via the API and the only thing I want is that the link object in the retrieved post has a different URL.

Upvotes: 1

Views: 1375

Answers (3)

Ashish Patel
Ashish Patel

Reputation: 3634

check word press codex:

https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

you can display your word press without move your directory from sub folder to root folder and can remove sub-directory from URL.

Upvotes: -1

christian Nguyen
christian Nguyen

Reputation: 1600

I don't know. Just try to help. This is my solution redirect what need to redirect.

    Options +FollowSymLinks
    RewriteEngine On
    RewriteRule ^wordpress/wp-json/(.*)$ http://domain.com/wordpress/wp-json/$1 [R=301,NC,L]
    RewriteRule ^wordpress/(.*)$ /$1 [R=301,NC,L]

Upvotes: 2

Manish Shukla
Manish Shukla

Reputation: 1365

you want to change wordpress domain or URL. you need to perform following steps.

1 you need to modify all url's stored in database. I prefer to use https://interconnectit.com/ tool. It is pretty good and easy.

2 Once you update all database urls then you need to login in wp-admin and just update permalink settings.

  1. you need to check plugins too. Some plugins may get deactivated you need to activate them again.

Hope this will help.

Upvotes: 0

Related Questions