In this tutorial you will learn how to move the .htaccess rules to a virtual host conf file for a WordPress CMS.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# WordPress Move .htaccess rules to virtual host conf # WordPress generated .htaccess cd /var/www/wp.liviubalan.com/ mv .htaccess .htaccess-bak sudo vi /etc/apache2/sites-available/wp.liviubalan.com.conf <Directory "/var/www/wp.liviubalan.com/"> # BEGIN WordPress #<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] #</IfModule> # END WordPress </Directory> # Restart Apache sudo service apache2 restart # .htaccess: # is parsed on every request # used on shared hosting # don't require Apache to be restarted after configuration changes # Browser http://wp.liviubalan.com/ http://wp.liviubalan.com/hello-world # Useful links https://muffinresearch.co.uk/avoiding-the-use-of-htaccess-for-performance/ http://stackoverflow.com/questions/26559/any-negative-impacts-when-using-mod-rewrite |
Useful links:
https://muffinresearch.co.uk/avoiding-the-use-of-htaccess-for-performance/
http://stackoverflow.com/questions/26559/any-negative-impacts-when-using-mod-rewrite