1

In my .htaccess file I have these rewrites

#RewriteCond %{REQUEST_FILENAME} !-d #RewriteCond %{REQUEST_FILENAME} !-f #RewriteRule ^([^\.]+)$ $1.php [NC,L] RewriteRule ^/admin/$ http://socialable.comuv/admin.php [R=301,L] #noted out three lines since it's not what I need anymore I forgot the RewriteRule originally 

Yet now it seems to not work at all, it keeps giving errors everywhere. I want is this

/admin/ (directory) to become /admin.php (file)
administration.php to become /administration

1 Answer 1

4

Try this:

RewriteRule ^admin/?$ admin.php [R,L] RewriteRule ^administration\.php administration [R,L] 

Once you are satisfied that the redirect works, you can change the R to R=301 to make it permanent.

Sign up to request clarification or add additional context in comments.

17 Comments

Ok I've gotten these to work, but I need to get if the user types /admin which is a directory to redirect to /admin.php instead
Also why are your flags [R,L] and then [L,R] ? I don't know what they mean just curious though.
Regarding the flags: no reason, just came out that way. :) Regarding your redirection for admin: you mean, you don't want to go to http://example.com/admin.php, just admin.php ?
Hey EasyBB, no please don't add an .htaccess in the admin folder. Looks like thanks to anu's keen eyes we're now all on the same page. Please see the edited answer.
@anubhava Thanks, taking a break from answering—might come back for an hour sometime later—see you. :)
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.