Community Forums › Forums › Archived Forums › Design Tips and Tricks › Changing the URL base
Tagged: base, move, permalinks, subdirectory
- This topic has 3 replies, 2 voices, and was last updated 8 years, 3 months ago by unklee.
-
AuthorPosts
-
September 28, 2015 at 1:03 am #166815unkleeMember
Hi,
I have purchased Genesis Framework and Minimum Pro theme, to upgrade an existing website and blog. My question is about WordPress rather than Genesis.
My current website is composed of about a hundred HTML/CSS pages I have coded myself, in about 8 different subdirectories, with a WordPress blog in a /blog subdirectory. When I install Genesis I want to also convert all the HTML pages into WordPress pages. To maintain continuity, I want everything to have the same URL as now, which will be sitename/parentpagename/pagename for pages, and sitename/blog/category/postname for posts. But with WordPress in the /blog folder, the page URLs will be sitename/blog/parentpagename/pagename, which I don't want (it will look clumsy and break any bookmarks readers have).
I know one way to achieve what I want is to move the blog out of the /blog subdirectory and use Permalinks to add the /blog to the post URLs, but this scares me as the process is complex and I'm worried I might lose contact with my database and so lose all the existing posts and comments.
So this is what I want to do, if it is possible. I want to keep WordPress in the /blog folder and use a plugin or modify the PHP to take the /blog out of the URL base. Then I will add /blog back into just the posts using Permalinks.
Can anyone please tell me if this is possible, and if so, is there a plugin to achieve it, or which file contains the PHP I would have to modify. Thanks.
http://www.is-there-a-god.infoSeptember 28, 2015 at 7:30 am #166840Victor FontModeratorPermalinks are used globally by WordPress. If you add /blog to your permalinks, every page and post will have /blog/. Rather than mess with the permalinks, this should work if you create proper parent/child relations the pages, and parent/child categories for your posts. If you set permalinks to postname, the breadcrumbs and URL will show the structure you want.
https://codex.wordpress.org/Using_Permalinks
https://codex.wordpress.org/Pages
https://codex.wordpress.org/Manage_Categories_SubPanel
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?September 28, 2015 at 3:55 pm #166891unkleeMemberHi Victor, thanks for your reply. But I'm sorry, I don't understand how to remove the /blog without moving WordPress out of the /blog directory.
January 16, 2016 at 5:55 am #176675unkleeMemberI don't know if anyone will ever read this, but I have managed to make the WordPress static home page the home page for the whole website while keeping the WordPress install in the /blog directory and keeping the URL for posts as sitename/blog/postname.
It was actually quite easy, so I thought I'd document it here if anyone else needs to do it.
At the start, the main website (including the home page) was HTML, and the whole WordPress install was in the /blog directory.
1. Go the WP Dashboard, Settings, General and change Site address to the root URL (but don't change the WordPress address) and save.
2. Copy (not move) the WP index.php and .htaccess files into the root.
3. Edit the index.php file (near the end) so that it readsrequire( dirname( __FILE__ ) . '/blog/wp-blog-header.php' );
instead ofrequire( dirname( __FILE__ ) . '/wp-blog-header.php' );
and save.
4. Login to site at old address, go to the Dashboard, Settings, Permalinks and reset permalinks by adding /blog - before I had filename/%category%/%postname/", now I have filename/blog/%category%/%postname%/
5. Amend links in main menu as necessary.All done.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.