My WordPress installed in root directory www.example
I need home and site URL like below.
Site_url. www.example Home_url www.example/blog
I need prefix '/blog' for all frond end URL.
Please let me know how we can achieve this?
Is there any code level changes required for this?
I tried this and it is working, I am facing issue with w3 total cache plugin. Issue is CSS/JS minify not working. If both site and home URL same then only CSS/J's minify working.
Please suggest.
My WordPress installed in root directory www.example.com
I need home and site URL like below.
Site_url. www.example.com Home_url www.example.com/blog
I need prefix '/blog' for all frond end URL.
Please let me know how we can achieve this?
Is there any code level changes required for this?
I tried this and it is working, I am facing issue with w3 total cache plugin. Issue is CSS/JS minify not working. If both site and home URL same then only CSS/J's minify working.
Please suggest.
First, go to your Permalinks settings in your Admin Panel > Settings > Permalinks, on Custom Structure you will see something like this:
So let’s add at the begining the word ‘/blog‘, it will look like this:
HOW TO ADD ‘/BLOG/’ IN FRONT OF YOUR URL
To achieve the desired setup where the site URL is www.example.com and the home URL is www.example.com/blog, you can follow these steps:
1. WordPress Settings:
2. Move WordPress Files:
In index.php:
require( dirname( FILE ) . '/blog/wp-blog-header.php' );
In .htaccess:
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
3. Update Permalinks: In the WordPress dashboard, go to Settings > Permalinks and update the permalink structure. This will refresh the rewrite rules.
4. Update Site URL in Database: If you still face issues with plugins, you may need to update the site URL directly in the database. Use phpMyAdmin or a similar tool to execute the following SQL queries:
UPDATE wp_options SET option_value = 'http://www.example.com/blog' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'http://www.example.com' WHERE option_name = 'home';
5. Clear Caches: After making these changes, clear your browser cache and any caching plugins you are using.
W3 Total Cache: For W3 Total Cache issues, try the following:
If the issue persists, you may need to check for any specific compatibility issues between the WordPress setup with a subdirectory and the W3 Total Cache plugin. Consider checking the plugin's support forums or documentation for any known issues or solutions.
Be sure to back up your site before making significant changes to ensure you can restore it if something goes wrong.