Is it possible to run wordpress as a sub url of a website (for example /blog) as the other urls are under control of a framework (like laravel or codeigniter) ? And if yes how?
PS: I don't want to use a different subdomain.
My Answer:
Yes, it is possible to run WordPress as a subdirectory (e.g. /blog) of a website that is using a PHP framework like Laravel or CodeIgniter.
To achieve this, you can follow these steps:
1. Install WordPress in a subdirectory on your server, such as /blog.
2. Update the WordPress site URL in the WordPress settings to reflect the subdirectory (e.g. http://example.com/blog).
3. Modify the .htaccess file in the root directory of your website to include the following code before any existing rewrite rules:
RewriteEngine On
RewriteBase /
RewriteRule ^blog/(.*)$ /blog/index.php/$1 [L]
4. Update the routes in your PHP framework (Laravel or CodeIgniter) to exclude the /blog subdirectory from being handled by the framework. This can usually be done by adding a specific route or condition to ignore requests to the /blog subdirectory.
By following these steps, you should be able to run WordPress as a subdirectory of your website while still using a PHP framework for the rest of your site.
Rate this post
3 of 5 based on 4040 votesComments