0

Hi,

I have the following htaccess file:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
    RewriteCond %{REQUEST_FILENAME} -d [NC]
    RewriteRule .* - [L]

    DirectoryIndex /index.php

    RewriteRule ^([^/.]*)$ $1/ [R]
    RewriteRule ^([^/.]*)/$ /$1.php [QSA]

</IfModule>

This works fine, if I put for example /legal/ it loads up legal.php however if legal.php didnt exist I need it to put index.php?username=legal

Can this be done?

Thanks,
Daniel

2
Contributors
5
Replies
12
Views
2 Years
Discussion Span
Last Post by Danny159
0

What's wrong with a 404?

This seems to be dual purpose. Are you looking for a fallback?

Prob best to have a rewrite to /users/legal/

Edited by diafol

0

No, what I am trying to do is use the /filenotexists/ to be a dynamic username so you can put /anything but if /anything is a .php file in the root it will show that, if its not a .php file in the root it will add it to index.php?username=anything

Hope this makes sence?
Thanks

0

I thought the answer in the link I gave addressed that.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.