How to rewrite a folder name in URL using htaccess

I want to rewrite a folder name(administrator) to (admin) in the URL using .htaccess.


For eg;

My actual url:

        http://localhost/administrator/index.php

it should be rewritten as

         http://localhost/admin/index.php


So end user should not aware about my administrator folder.
he should call the administrator side using admin folder.




kumarjcetAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sweetfa2Commented:
RewriteEngine on
^/administrator(.*) /admin$1

Open in new window

0
StingRaYCommented:
RewriteEngine on
RewriteBase /
^/administrator/(.*) /admin/$1

Open in new window

0
StingRaYCommented:
RewriteEngine on
RewriteBase /
RewriteRule ^/administrator/(.*) /admin/$1
RewriteRule ^/administrator$ /admin

Open in new window

0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

kumarjcetAuthor Commented:
I have used this one


RewriteRule ^admin/(.*) administrator/$1


this is working

http://localhost/admin/index.php ...



Now the issue is

while redirecting to  http://localhost/administrator/test.php  

it should automatically rewrite as  http://localhost/admin/test.php

but i am getting only  http://localhost/administrator/test.php  


Any help on this...




0
StingRaYCommented:
RewriteEngine on
RewriteBase /
RewriteRule ^/admin/(.*) /administrator/$1
RewriteRule ^/admin$ /administrator

Open in new window

0
StingRaYCommented:
By my latest reply, when user access http://localhost/admin/test.php, he will be redirected to http://localhost/administrator/test.php.
0
torakeshbCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.