I would like to display a certain path in the URL but actually server content from another path using htaccess

Hi all

I would like to display a certain path in the URL but actually server content from another path. How can I achieve the following using my .htaccess Apache file please?

I want to have a URL with the word attachments

but actually serve the content located at /images/plots/

Thanks in advance, Neil
Neil ThompsonSenior Systems DeveloperAsked:
Who is Participating?
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.

David S.Consultant & Challenge SubduerCommented:
You're looking for "mod rewrite". Here's a tutorial that seems to answer your question: https://www.elated.com/mod-rewrite-tutorial-for-absolute-beginners/ Example 2 may be particularly helpful.

Here's another article on it: https://www.smashingmagazine.com/2011/11/introduction-to-url-rewriting/

Here's the official documentation: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

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
Neil ThompsonSenior Systems DeveloperAuthor Commented:
superb, many thanks :)
Neil ThompsonSenior Systems DeveloperAuthor Commented:
Just in case anyone is after the outcome it was:

RewriteRule ^attachments/([^~]+)/?$ /images/plots/$1
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.