By DudiDude


2019-04-14 13:20:39 8 Comments

I am testing the integration of a VueJS app in WordPress. It actually works (no styles yet).

BUT

If I access a URL like https://example.com/my-vue-route/about, the .htaccess URL rewriting redirects any incoming HTTPS request to the index.php of WordPress. So I actually never land on /my-vue-route/about but on the /about page, as WordPress thinks I made a typo.

Is it somehow possible to keep the vue routes out of this URL rewriting?

1 comments

@leymannx 2019-04-14 14:00:56

This is the default WordPress .htaccess:

# 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

Please add add the following line to it to prevent the default behavior for your custom route.

RewriteCond %{REQUEST_URI} !^/my-vue-route/(.+)

Like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/my-vue-route/(.+)
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Related Questions

Sponsored Content

1 Answered Questions

Extend page routing with custom parameters

  • 2013-08-09 07:16:42
  • hsz
  • 439 View
  • 0 Score
  • 1 Answer
  • Tags:   routing

1 Answered Questions

[SOLVED] Routing multiple routes to the default page

  • 2018-09-20 18:18:59
  • Mike Cole
  • 57 View
  • 0 Score
  • 1 Answer
  • Tags:   routing

1 Answered Questions

[SOLVED] Custom URL routing based on cookie value

1 Answered Questions

Group based routing and administration

1 Answered Questions

[SOLVED] What php files handles routing?

  • 2014-12-14 03:00:48
  • william007
  • 861 View
  • 0 Score
  • 1 Answer
  • Tags:   routing

1 Answered Questions

[SOLVED] How does routing on wordpress work?

  • 2014-04-12 07:46:59
  • yeahman
  • 26163 View
  • 13 Score
  • 1 Answer
  • Tags:   urls routing

1 Answered Questions

[SOLVED] WP custom routing does not work

0 Answered Questions

1 Answered Questions

[SOLVED] Custom routing for plugins

1 Answered Questions

[SOLVED] Debugging WP routing

Sponsored Content