Install PHP Application and WordPress Alongside Each Other

by Max Rohde,


You have a webpage like and you would like to serve both WordPress and files from a PHP application from the root domain. For instance, opening

will open a post on WordPress and

will open a page in a PHP application.


  • Set up your php application in /var/www/html
  • Install WordPress /usr/share/wordpress
  • Put the following lines into /usr/share/wordpress/.htacces before # BEGIN WordPress.
RewriteEngine On RewriteBase / RewriteCond "/var/www/html%{REQUEST_URI}" -f RewriteRule ^/?(.\*)$ /app/$1 \[L\]

BEGIN WordPress


  • Put the following line into聽/etc/httpd/conf/httpd.conf

Alias /app /var/www/html

  • Add the following configuration file to聽/etc/httpd/conf.d/wordpress.conf

Alias /wordpress /usr/share/wordpress DocumentRoot /usr/share/wordpress

<Directory /usr/share/wordpress/> AddDefaultCharset UTF-8

AllowOverride All

Require all granted

Restart httpd and you are all done!

Tags: wordpress
Categories: linux