I have a blog on wordpress, for example www/blog.com – folder
and my site example.com, www/example.com – folder.
I try integrate worpress with my site. example.com/blog – must go to wordpress index page, and example.com/blog/post_name must go to wordpress post.
apache conf
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example.com
ServerAlias www.example.com
Alias /blog /var/www/blog.com
<Location /blog>
</Location>
</VirtualHost>
<Directory /var/www/example.com>
#code
</Directory>
<Directory /var/www/blog.com>
#code
</Directory>
In worpress admin panel i change:
WordPress Address (URL) to example.com/blog
Site Address (URL) to example.com
Permalink Settings to /blog/%postname%/
When i go to example.com/blog it work fine, but when i type
example.com/blog/post_name i have 404 error.
Edit:
request example.com/blog go to wordpress directory, but example.com/blog/post_name go to example.com index.php
check out this wordpress.org article. it will help you ensure that you have mod_rewrite enabled, along with inserting the
AllowOverride FileInfo
directive that I can already see you’re missing within yourVirtualHost
. Don’t forget to read on about the .htaccess file for your /blog (/var/www/blog.com) directory. You’ll want to make sure yourRewriteBase
is set to/blog