I have a file called filename-step1.php
and looking to make the url domain.com/filename/step1
through .htaccess.
My current .htaccess
file looks like:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]
At the moment, this works fine for removing the .php
tag from the url. Just need to fix the directories.
2
Answers
You could add a
RewriteRule
to redirect to$1/$2.php
So,
filename/step1
will trigger thefilename-step1.php
file.I am giving 2 solutions here, please try one at a time only in your .htaccess file. With your shown samples, could you please try following as a Generic rules.
OR in case you are looking for specifically url
filename/step1
try following.