I'm using Barba in a project with PHP and I want to remove the '.php' extension in the URL.
I tried to change the href
of all <a>
from /my-page.php
to /my-page
for example but then I get 2 issues:
- An error 406 from Barba in the console when I hover the link
- When I click on the link, the page loads without Barba (no page transition).
I also tried some redirect 301 in the .htaccess
file but I get the exact same issues. Here is my .htaccess
(redirect found here: https://stackoverflow.com/a/13225718/16478297):
RewriteEngine On
# browser requests PHP
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]
# check to see if the request is for a PHP file:
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /$1.php [L]
I can't find anything in the documentation, is it even possible?