Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3273468
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:56:07+00:00 2026-05-17T18:56:07+00:00

Here’s a problem I’m always wanting to solve with htaccess. I haven’t found a

  • 0

Here’s a problem I’m always wanting to solve with htaccess. I haven’t found a way yet, though it looks like it should be possible – perhaps someone can help.

Let’s say I have a folder at the root of my site called /foo/. I want users to be able to access that folder at the path /bar/, but for various reasons I can’t rename the folder.

So as not to create confusion I only want one path to ever be seen – that is to say, I don’t want people to use the name /foo/ to access the folder; they should always use /bar/. If someone goes to example.com/foo/, their browser should redirect to example.com/bar/ – but the content returned should be the content of /foo/.

To make matters more complicated, pages in /foo/ have dependencies (images, stylesheets, links to other pages, etc) within /foo/ which are hardcoded and can’t be changed. These must, of course, still work.

So, to summarise, this is what I want :

  • Requests for example.com/foo/ should redirect to example.com/bar/.
  • Requests for example.com/bar/ should return the contents of example.com/foo/.

Is this possible? It looks on the surface as if it would create an infinite redirect… but I’m pretty sure there are ways to prevent that in htaccess, aren’t there?

I’d be very grateful for any help.

(PS – for a little extra background: The normal reason I want to do this is to rename the wordpress /wp-admin/ directory to something more professional and easy for customers to remember, such as /admin/. But the same system should work for masking any path in this way.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:56:07+00:00Added an answer on May 17, 2026 at 6:56 pm

    I found a sort of workaround – by using a symlink and htaccess in combination.

    First I created a symlink from /bar to /foo/.
    Then I put this in htaccess :

    Options +FollowSymLinks
    RewriteRule ^foo/(.*)$ bar/$1 [R,L]
    

    This has exactly the desired result – example.com/bar/ shows the content of the /foo/ directory, and example.com/foo/ redirects to example.com/bar/

    But if anyone can come up with a pure htaccess solution I’d much prefer that!


    Update :

    Ok, I’ve finally found out how to do this. It turns out to be quite simple…

    RewriteCond %{THE_REQUEST} ^GET\ /foo/
    RewriteRule ^foo/(.*)$ bar/$1 [R,L]
    
    RewriteRule ^bar/(.*)$ foo/$1
    

    The only problem is that it doesn’t take account of RewriteBase, so you have to include the full path in the first line (after ^GET\).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a coding problem for those that like this kind of thing. Let's see
Here's a problem I ran into recently. I have attributes strings of the form
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
Here’s a problem I’ve really been struggling with. I need to merge two sorted
I'm getting an error here that says I haven't defined a method, but it
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is my code, which takes two version identifiers in the form 1, 5,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.