# Publishing a VuePress project using Apache

In case you are not interested in following the suggestions from deployment sectionopen in new window of VuePress guide and wish to publish your static website built using VuePress using Apache, or in case you are stuck on shared hosting and have no option, use the following .htaccess.

You can place the .htaccess file below at .vuepress/public folder to have it copied to your dist folder automatically. Then copy the contents of .vuepress/dist to your Apache public_html. Make sure to have the mod_rewrite enabled!

DirectoryIndex index.html

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# You can also add other RewriteRules around here
# Redirect 301 /oldurl /a-new-url.html

RewriteRule ^index\.html$ - [L]
ErrorDocument 404 /404.html

# Do not redirect everything else to index, otherwise no 404 will be triggered
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.html [L]
</IfModule>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Last updated: Jun 12, 2021