Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to enable HTML5 History Mode?

Hi,


I'm struggling to enable How to enable HTML5 History Mode for my vue2 based single page application as described here https://router.vuejs.org/en/essentials/history-mode.html


When I apply the below lines in the config of the website, none of the hosted websites are reachable anymore 😟

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] </IfModule>

Xserve, OS X El Capitan (10.11.6)

Posted on Dec 13, 2017 3:03 AM

Reply
Question marked as Best reply

Posted on Dec 13, 2017 4:17 AM

Just found the (obvious?) solution after spinning around this yesterday.

Thought I'd share this:


In Server App settings page for the website select "Edit Advanced Settings..."

Enable "Allow overrides using .htaccess files"


In the root folder of the website, create a file by the name .htaccess

Edit the .htaccess file and enter below lines for the history mode to work:



<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.html$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.html [L]

</IfModule>

1 reply
Question marked as Best reply

Dec 13, 2017 4:17 AM in response to srune

Just found the (obvious?) solution after spinning around this yesterday.

Thought I'd share this:


In Server App settings page for the website select "Edit Advanced Settings..."

Enable "Allow overrides using .htaccess files"


In the root folder of the website, create a file by the name .htaccess

Edit the .htaccess file and enter below lines for the history mode to work:



<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.html$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.html [L]

</IfModule>

How to enable HTML5 History Mode?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.