0

I'm using this .htaccess for remove .php in my URLs

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

My files structure is this:

css/
es/
-- contact.php
-- index.html
js/
contact.php
index.php

What I'm trying to create is a link in my main index.php like this:

<a href="es/">EspaƱol</a>

But when I try to access it, my server returns a 404 error. When I delete the .htaccess, this link works fine, so I guess that I need something else in the .htaccess. Can anybody please guide me on what do I have to add for this to work?

cristiancastrodc
  • 188
  • 1
  • 13

1 Answers1

1

With test for php and without folder:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
Croises
  • 18,570
  • 4
  • 30
  • 47