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?

1 Answer 1

1

With test for php and without folder:

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^ %{REQUEST_URI}.php [L] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.