skip to Main Content

I want to rewrite example.com/login into example.com/login.php
this used to work on my old server as I was using this rule in the .htaccess file:

RewriteRule ^login$ login.php [L]

when I migrated to a new server, this specific rule has stopped from working, but if I change login to loginx for example

RewriteRule ^loginx$ login.php [L]

the rule works and I see the login page when I go to example.com/loginx

also, if I change the filename, the rule starts to work too

RewriteRule ^login$ loginx.php [L]

It looks like if the rule and the file has the same name (login in this case) the rule doesn’t work for a reason I can’t understand, does anybody knows why this happens and how to deal with it?

Here’s the full .htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule ^login$ login.php [L]
RewriteRule ^users$ users.php [L]
RewriteRule ^profile$ me.php [L]

the problem happens with the users too (because the file has the name as the URL)
the profile rule works correctly.

2

Answers


  1. Chosen as BEST ANSWER

    I got it working thanks to 04FS
    I just added

    Options -Multiviews
    

    in the top of my htaccess file


  2. Did you add RewriteEngine On above it in the .htaccess?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search