0

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.

0

2 Answers 2

0

First, go to your Permalinks settings in your Admin Panel > Settings > Permalinks, on Custom Structure you will see something like this: enter image description here

So let’s add at the begining the word ‘/blog‘, it will look like this:

enter image description here

HOW TO ADD ‘/BLOG/’ IN FRONT OF YOUR URL

0

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:

  • Move all the WordPress files and folders to the /blog directory.
  • Update the index.php and .htaccess files in the root directory to reflect the new path:

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:

  • Clear W3 Total Cache cache.
  • If minification issues persist, try turning off minification, clear cache, and then turn it back on.
  • Make sure the minified files have the correct paths after changing the site URL.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.