logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: using .htaccess to "change" directory structure
Author
Hotaru



Joined: 29 Jul 2008
Posts: 2
Location: Big Orange

PostPosted: Mon 27 Apr '09 17:00    Post subject: using .htaccess to "change" directory structure Reply with quote

Xitami is the server I am used to, but now I need to help a site using Apache clean up their URLs

They decided the canonical root for their site will be
http://example.com/docs/index.html

Some printed materials have URLs like this:
http://example.com/items/lists/docs/example.pdf
which now needs to go to:
http://example.com/docs/example.pdf

But there are also URLs like this:
http://example.com/docs/items/lists/example.pdf
which now needs to go to:
http://example.com/docs/items/lists/example.pdf

Also,
http://*.example.com/*
and
http://example.com/* ;except for /docs/*
now go to the canonical root.

So now, what rules can I use to accomplish all this?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 28 Apr '09 9:38    Post subject: Reply with quote

A rewriting with a .htaccess file in your /items/lists/docs folder

Quick and dirty, but that should work.
Code:

RewriteEngine On
RewriteRule (.*) http://example.com/docs/%{REQUEST_URI}


Your second URL I can't see the difference.
Back to top


Reply to topic   Topic: using .htaccess to "change" directory structure View previous topic :: View next topic
Post new topic   Forum Index -> Apache