Is it possible to alias a folder like this?

Struggling trying to find out if this is even possible. I have a folder that contains a ‘mini site’ on a website (actually 38 of them), these mini site folders are located in a folder called ‘sites’. We did this because when the site was bought these folders were all over the root (along with a thousand other nonsense files) and we needed to organize it some.

Well the owner doesn’t like the {domain}/sites/mini-site-folder/ layout and wants them to be {domain}/mini-sites-folder

Now short of moving them all back to the root folder I can’t seem to find a way to alias them so that {domain}/mini-sites-folder resolves to {domain}/sites/mini-site-folder/ I asked my server guy to look at it and he tried for a few days but couldn’t come up with anything.

I’m pretty sure there is a way to do it because I’ve seen things like this done on other sites but for the life of me (and my server guy) I can’t find it

Any help would be appreciated … I shudder at the thought of moving them all back into the root :frowning:

Yes once we get all the issues solved it will all get neatly packed in the config file.

So basically you are saying those couple are no gos?

I have fixed the internal server error problems by moving your code below mine, my PHP handler grabs it and shows on of my error pages

Yes we know it is huge and burdensome but it will be moved to the config file once testing is done … the problem here is we are trying to ‘fix’ a site that has been an utter disaster since it was created in 1996, this guy just piled more and more crap on in any way shape or form he could … now the real problem is the site has some amazing rankings (why it was bought by my client)

Will have to ‘ponder the masters words’ on that last bit :smiley:

Dave,

No problem! That’s what I’m here for (to help others learn).

Do you have access to httpd.conf (actually, the httpd-vhosts.conf for your domain)? If so, move all the Redirects that work there so they’re only read once (rather than for EVERY @#$% file request!).

How is RedirectMatch 301 /hollis /hollis-farms/ supposed to tell hollis{followed by anything} from hollis-farms? Admittedly, I see your mod_alias directive with my mod_rewrite (regex) blinders on but it looks like it should be loopy!

:tup: “Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”

That’s what I’d expect.

Since you have that for (all?) your RedirectMatch statements, I’m shocked that your Apache hasn’t packed up its teepee and headed for the Great Plains!

It dawned on me after testing that the old folder (hollis) is the first word in the new folder and every one that is like that throws the same error. The ones (like the working one above) had a goofy folder name like pipecreek or dht, or hht) … that first word in the new folder name no longer exists so the new rewrite condition and rule you posted works as expected.

Okay, you found that problem, too!

Next, do you really expect rrreoirthwerhiew NOT to be matched by

RewriteEngine on
Options +FollowSymlinks

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# prevent this causing a loop
RewriteCond %{REQUEST_URI} !^sites/
RewriteRule [COLOR="Red"].?[/COLOR] sites%{REQUEST_URI} [L]

# If the URI doesn't end with .js and .jpeg and .jpg and .gif and .css or any others
RewriteCond %{REQUEST_URI} !\\.(js|jpe?g|gif|css|swf|html|jsp|ico|png|xml|xsl|rdf|txt|gz|php|shtml|pdf|zip|htm)$ [NC]

# apply transformations

RewriteRule ^[COLOR="Red"]([^/]+)[/COLOR]$ index.php?pageName=$1 [L]

Note that BOTH red bits WILL match rrreoirthwerhiew with the sites/rrreoirthwerhiew taking precedence (order) at which time

RewriteCond %{REQUEST_URI} !\\.(js|jpe?g|gif|css|swf|html|jsp|ico|png|xml|xsl|rdf|txt|gz|php|pdf|zip|htm)$ [NC]

RewriteRule ^([^/]+)/([^/]+)$ index.php?pageName=$1&id=$2 [L]

will kick-in and redirect to index.php with sites as the pageName value and id=rrreoirthwerhiew! If index.php can’t handle that jibberish, you’re in real trouble!

Does that mean you’ve fixed it the way you need?

IMHO, you need to “trim” your .htaccess to something more reasonable else you’ll be burdening your server far too much with every file request.

Then think like mod_rewrite and “see” how each request is handled - remembering to follow the redirections through the next loop (mod_rewrite keeps looping back through until no more redirections are found/executed).

What you’ve encountered is similar to the problem that noobies have when they use (.*) to match (NOTHING or EVERYTHING) and wonder why their redirections never end (go loopy). If you’re as exact as possible in defining the {REQUEST_URI} string which you need to be redirected, that tends to avoid the loop problem.

Regards,

DK

I was able to solve the internal server error when nothing was found (my gibberish url above) and the problem of my rewrite not working for the site pages by moving your condition after mine … making progress here.

RedirectMatch 301 /brochure.htm /advertise-with-hunt-info
RedirectMatch 301 /chopblock.htm /wild-game-meat-care
RedirectMatch 301 /recipes.htm /venison-recipes
RedirectMatch 301 /o&g.htm /outfitters-guides-listing
RedirectMatch 301 /reviews.htm /outfitter-guides-product-reviews
RedirectMatch 301 /state.htm /state-regional-hunting-info
RedirectMatch 301 /links.htm /hunting-information-links
RedirectMatch 301 /aboutus.htm /about-hunt-info
RedirectMatch 301 /products.htm /hunting-gear-reviews
RedirectMatch 301 /fields1.htm /field-dressing-deer
RedirectMatch 301 /OK /oklahoma-outfitter-guide-reviews
RedirectMatch 301 /NV /nevada-outfitter-guide-reviews
RedirectMatch 301 /MT /montana-outfitter-guide-reviews
RedirectMatch 301 /AK /alaska-outfitter-guide-reviews
RedirectMatch 301 /OH /ohio-outfitter-guide-reviews
RedirectMatch 301 /IL /illinois-outfitter-guide-reviews
RedirectMatch 301 /NJ /new-jersey-outfitter-guide-reviews
RedirectMatch 301 /reviews/product_reviews.php /hunting-gear-reviews
RedirectMatch 301 /reviews/outfitter_submit.php /submit-outfitter-review
RedirectMatch 301 /GA /georgia-outfitter-guide-reviews
RedirectMatch 301 /CO /colorado-outfitter-guide-reviews
RedirectMatch 301 /AR /arkansas-outfitter-guide-reviews
RedirectMatch 301 /MD /maryland-outfitter-guide-reviews
RedirectMatch 301 /NY /new-york-outfitter-guide-reviews
RedirectMatch 301 /ND /north-dakota-outfitter-guide-reviews
RedirectMatch 301 /ME /maine-outfitter-guide-reviews
RedirectMatch 301 /LA /louisiana-outfitter-guide-reviews
RedirectMatch 301 /KS /kansas-outfitter-guide-reviews
RedirectMatch 301 /NE /nebraska-outfitter-guide-reviews
RedirectMatch 301 /DE /delaware-outfitter-guide-reviews
RedirectMatch 301 /CT /connecticut-outfitter-guide-reviews
RedirectMatch 301 /MS /mississippi-outfitter-guide-reviews
RedirectMatch 301 /MI /michigan-outfitter-guide-reviews
RedirectMatch 301 /AZ /arizona-outfitter-guide-reviews
RedirectMatch 301 /MN /minnesota-outfitter-guide-reviews
RedirectMatch 301 /MO /missouri-outfitter-guide-reviews
RedirectMatch 301 /SC /south-carolina-outfitter-guide-reviews
RedirectMatch 301 /CA /california-outfitter-guide-reviews
RedirectMatch 301 /AL /alabama-outfitter-guide-reviews
RedirectMatch 301 /IA /iowa-outfitter-guide-reviews
RedirectMatch 301 /FL /florida-outfitter-guide-reviews
RedirectMatch 301 /MA /massachusetts-outfitter-guide-reviews
RedirectMatch 301 /HI /hawaii-outfitter-guide-reviews
RedirectMatch 301 /NM /new-mexico-outfitter-guide-reviews
RedirectMatch 301 /NH /new-hampshire-outfitter-guide-reviews
RedirectMatch 301 /KY /kentucky-outfitter-guide-reviews
RedirectMatch 301 /IN /indiana-outfitter-guide-reviews
RedirectMatch 301 /NC /north-carolina-outfitter-guide-reviews
RedirectMatch 301 /ID /idaho-outfitter-guide-reviews
RedirectMatch 301 /copyright.htm /huntinfo-terms-conditions

RedirectMatch 301 /maplelane/ http://www.ashridgecabins.com/maplelaneop/

RedirectMatch 301 /whitetailwishes/ /whitetail-wishes-outfitters/
RedirectMatch 301 /whitetailwishes /whitetail-wishes-outfitters/
RedirectMatch 301 /tickridge/ /tick-ridge-outfitters/
RedirectMatch 301 /tickridge /tick-ridge-outfitters/
RedirectMatch 301 /wyoedge/ /wyoming-edge-outfitters/
RedirectMatch 301 /wyoedge /wyoming-edge-outfitters/
RedirectMatch 301 /406/ /406-ranch/
RedirectMatch 301 /allseasons/ /all-seasons-guide-service/
RedirectMatch 301 /allseasons /all-seasons-guide-service/
RedirectMatch 301 /rro/ /racoon-river-outfitters/
RedirectMatch 301 /rro /racoon-river-outfitters/
RedirectMatch 301 /westernmt/ /western-montana-guide-school/
RedirectMatch 301 /westernmt /western-montana-guide-school/
RedirectMatch 301 /royaltine/ /royal-tine-outfitter-guide-school/
RedirectMatch 301 /royaltine /royal-tine-outfitter-guide-school/
RedirectMatch 301 /riverview/ /river-view-lodge/
RedirectMatch 301 /riverview /river-view-lodge/
RedirectMatch 301 /pcrossbar/ /p-cross-bar/
RedirectMatch 301 /pcrossbar /p-cross-bar/
RedirectMatch 301 /lonestar/ /lone-star-ranch/
RedirectMatch 301 /lonestar /lone-star-ranch/
RedirectMatch 301 /etom/ /edmund-tom-ranch/
RedirectMatch 301 /etom /edmund-tom-ranch/
RedirectMatch 301 /dodgecreek/ /dodge-creek-ranch-wyoming/
RedirectMatch 301 /dodgecreek /dodge-creek-ranch-wyoming/
RedirectMatch 301 /bearpaw.htm /bearpaw-outfitters/
RedirectMatch 301 /huntoncreek/ /hunton-creek-outfitters/
RedirectMatch 301 /huntoncreek /hunton-creek-outfitters/
RedirectMatch 301 /fwc/ /flat-willow-creek-outfitters/
RedirectMatch 301 /fwc /flat-willow-creek-outfitters/
RedirectMatch 301 /hht/ /hog-hunting-texas/
RedirectMatch 301 /hht /hog-hunting-texas/
RedirectMatch 301 /dht/ /deer-hunting-texas/
RedirectMatch 301 /dht /deer-hunting-texas/
RedirectMatch 301 /yo/ /yellowstone-outfitters/
RedirectMatch 301 /yo /yellowstone-outfitters/
RedirectMatch 301 /lazyhco/ /lazy-h-meadows-colorado/
RedirectMatch 301 /lazyhco /lazy-h-meadows-colorado/
RedirectMatch 301 /lazyhia/ /lazy-h-meadows-iowa/
RedirectMatch 301 /lazyhia /lazy-h-meadows-iowa/
RedirectMatch 301 /pipecreek/ /pipe-creek-guide-service/
RedirectMatch 301 /pipecreek /pipe-creek-guide-service/
RedirectMatch 301 /pipecreek2/ /pipe-creek-buffalo-hunts/
RedirectMatch 301 /pipecreek2 /pipe-creek-buffalo-hunts/


RedirectMatch 301 /hollis/ /hollis-farms/
RedirectMatch 301 /hollis /hollis-farms/
RedirectMatch 301 /jakes/ /jakes-rio-grande-outfitting/
RedirectMatch 301 /jakes /jakes-rio-grande-outfitting/
RedirectMatch 301 /abc/ /abc-ranch-ny/
RedirectMatch 301 /abc /abc-ranch-ny/
RedirectMatch 301 /powder/ /powder-river-bowhunts/
RedirectMatch 301 /powder /powder-river-bowhunts/
RedirectMatch 301 /jn/ /jn-ranch/
RedirectMatch 301 /jn /jn-ranch/
RedirectMatch 301 /hidden/ /hidden-valley-outfitters/
RedirectMatch 301 /hidden /hidden-valley-outfitters/
RedirectMatch 301 /elm/ /elm-outfitter-guide-training/
RedirectMatch 301 /elm /elm-outfitter-guide-training/


RewriteEngine on
Options +FollowSymlinks

# If the URI doesn't end with .js and .jpeg and .jpg and .gif and .css or any others
RewriteCond %{REQUEST_URI} !\\.(js|jpe?g|gif|css|swf|html|jsp|ico|png|xml|xsl|rdf|txt|gz|php|shtml|pdf|zip|htm)$ [NC]

# apply transformations

RewriteRule ^([^/]+)$ index.php?pageName=$1 [L]


RewriteCond %{REQUEST_URI} !\\.(js|jpe?g|gif|css|swf|html|jsp|ico|png|xml|xsl|rdf|txt|gz|php|pdf|zip|htm)$ [NC]

RewriteRule ^([^/]+)/([^/]+)$ index.php?pageName=$1&id=$2 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# prevent this causing a loop
RewriteCond %{REQUEST_URI} !^sites/
RewriteRule .? sites%{REQUEST_URI} [L]

First off thanks for the time, learning some new stuff here that is really cool!

Found out why I was blowing the server up and fixed that, have some of it working with the following exceptions (bare with me a bit)

  1. I have a multitude of 301 redirects on this mess and most are working, example:
RedirectMatch 301 /pipecreek/ /pipe-creek-guide-service/
RedirectMatch 301 /pipecreek /pipe-creek-guide-service/

But then I have some that throw an error, example:


RedirectMatch 301 /hollis/ /hollis-farms/
RedirectMatch 301 /hollis /hollis-farms/


Error is:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

It dawned on me after testing that the old folder (hollis) is the first word in the new folder and every one that is like that throws the same error. The ones (like the working one above) had a goofy folder name like pipecreek or dht, or hht) … that first word in the new folder name no longer exists so the new rewrite condition and rule you posted works as expected.

  1. When nothing is found (for example adding gibberish to the url) example:

http://localhost/rrreoirthwerhiew

I get an internal server error. This bothers me because there are many pages that no longer exist and we want a 404 to be thrown. Is there a ‘graceful’ way to send them to a 404 page that can be added to your code?

And just so you are getting the entire picture here is the complete htaccess file:

RedirectMatch 301 /brochure.htm /advertise-with-hunt-info
RedirectMatch 301 /chopblock.htm /wild-game-meat-care
RedirectMatch 301 /recipes.htm /venison-recipes
RedirectMatch 301 /o&g.htm /outfitters-guides-listing
RedirectMatch 301 /reviews.htm /outfitter-guides-product-reviews
RedirectMatch 301 /state.htm /state-regional-hunting-info
RedirectMatch 301 /links.htm /hunting-information-links
RedirectMatch 301 /aboutus.htm /about-hunt-info
RedirectMatch 301 /products.htm /hunting-gear-reviews
RedirectMatch 301 /fields1.htm /field-dressing-deer
RedirectMatch 301 /OK /oklahoma-outfitter-guide-reviews
RedirectMatch 301 /NV /nevada-outfitter-guide-reviews
RedirectMatch 301 /MT /montana-outfitter-guide-reviews
RedirectMatch 301 /AK /alaska-outfitter-guide-reviews
RedirectMatch 301 /OH /ohio-outfitter-guide-reviews
RedirectMatch 301 /IL /illinois-outfitter-guide-reviews
RedirectMatch 301 /NJ /new-jersey-outfitter-guide-reviews
RedirectMatch 301 /reviews/product_reviews.php /hunting-gear-reviews
RedirectMatch 301 /reviews/outfitter_submit.php /submit-outfitter-review
RedirectMatch 301 /GA /georgia-outfitter-guide-reviews
RedirectMatch 301 /CO /colorado-outfitter-guide-reviews
RedirectMatch 301 /AR /arkansas-outfitter-guide-reviews
RedirectMatch 301 /MD /maryland-outfitter-guide-reviews
RedirectMatch 301 /NY /new-york-outfitter-guide-reviews
RedirectMatch 301 /ND /north-dakota-outfitter-guide-reviews
RedirectMatch 301 /ME /maine-outfitter-guide-reviews
RedirectMatch 301 /LA /louisiana-outfitter-guide-reviews
RedirectMatch 301 /KS /kansas-outfitter-guide-reviews
RedirectMatch 301 /NE /nebraska-outfitter-guide-reviews
RedirectMatch 301 /DE /delaware-outfitter-guide-reviews
RedirectMatch 301 /CT /connecticut-outfitter-guide-reviews
RedirectMatch 301 /MS /mississippi-outfitter-guide-reviews
RedirectMatch 301 /MI /michigan-outfitter-guide-reviews
RedirectMatch 301 /AZ /arizona-outfitter-guide-reviews
RedirectMatch 301 /MN /minnesota-outfitter-guide-reviews
RedirectMatch 301 /MO /missouri-outfitter-guide-reviews
RedirectMatch 301 /SC /south-carolina-outfitter-guide-reviews
RedirectMatch 301 /CA /california-outfitter-guide-reviews
RedirectMatch 301 /AL /alabama-outfitter-guide-reviews
RedirectMatch 301 /IA /iowa-outfitter-guide-reviews
RedirectMatch 301 /FL /florida-outfitter-guide-reviews
RedirectMatch 301 /MA /massachusetts-outfitter-guide-reviews
RedirectMatch 301 /HI /hawaii-outfitter-guide-reviews
RedirectMatch 301 /NM /new-mexico-outfitter-guide-reviews
RedirectMatch 301 /NH /new-hampshire-outfitter-guide-reviews
RedirectMatch 301 /KY /kentucky-outfitter-guide-reviews
RedirectMatch 301 /IN /indiana-outfitter-guide-reviews
RedirectMatch 301 /NC /north-carolina-outfitter-guide-reviews
RedirectMatch 301 /ID /idaho-outfitter-guide-reviews
RedirectMatch 301 /copyright.htm /huntinfo-terms-conditions

RedirectMatch 301 /whitetailwishes/ /whitetail-wishes-outfitters/
RedirectMatch 301 /whitetailwishes /whitetail-wishes-outfitters/
RedirectMatch 301 /tickridge/ /tick-ridge-outfitters/
RedirectMatch 301 /tickridge /tick-ridge-outfitters/
RedirectMatch 301 /wyoedge/ /wyoming-edge-outfitters/
RedirectMatch 301 /wyoedge /wyoming-edge-outfitters/
RedirectMatch 301 /406/ /406-ranch/
RedirectMatch 301 /allseasons/ /all-seasons-guide-service/
RedirectMatch 301 /allseasons /all-seasons-guide-service/
RedirectMatch 301 /rro/ /racoon-river-outfitters/
RedirectMatch 301 /rro /racoon-river-outfitters/
RedirectMatch 301 /westernmt/ /western-montana-guide-school/
RedirectMatch 301 /westernmt /western-montana-guide-school/
RedirectMatch 301 /royaltine/ /royal-tine-outfitter-guide-school/
RedirectMatch 301 /royaltine /royal-tine-outfitter-guide-school/
RedirectMatch 301 /riverview/ /river-view-lodge/
RedirectMatch 301 /riverview /river-view-lodge/
RedirectMatch 301 /pcrossbar/ /p-cross-bar/
RedirectMatch 301 /pcrossbar /p-cross-bar/
RedirectMatch 301 /lonestar/ /lone-star-ranch/
RedirectMatch 301 /lonestar /lone-star-ranch/
RedirectMatch 301 /etom/ /edmund-tom-ranch/
RedirectMatch 301 /etom /edmund-tom-ranch/
RedirectMatch 301 /dodgecreek/ /dodge-creek-ranch-wyoming/
RedirectMatch 301 /dodgecreek /dodge-creek-ranch-wyoming/
RedirectMatch 301 /bearpaw.htm /bearpaw-outfitters/
RedirectMatch 301 /huntoncreek/ /hunton-creek-outfitters/
RedirectMatch 301 /huntoncreek /hunton-creek-outfitters/
RedirectMatch 301 /fwc/ /flat-willow-creek-outfitters/
RedirectMatch 301 /fwc /flat-willow-creek-outfitters/
RedirectMatch 301 /hht/ /hog-hunting-texas/
RedirectMatch 301 /hht /hog-hunting-texas/
RedirectMatch 301 /dht/ /deer-hunting-texas/
RedirectMatch 301 /dht /deer-hunting-texas/
RedirectMatch 301 /yo/ /yellowstone-outfitters/
RedirectMatch 301 /yo /yellowstone-outfitters/
RedirectMatch 301 /lazyhco/ /lazy-h-meadows-colorado/
RedirectMatch 301 /lazyhco /lazy-h-meadows-colorado/
RedirectMatch 301 /lazyhia/ /lazy-h-meadows-iowa/
RedirectMatch 301 /lazyhia /lazy-h-meadows-iowa/
RedirectMatch 301 /pipecreek/ /pipe-creek-guide-service/
RedirectMatch 301 /pipecreek /pipe-creek-guide-service/
RedirectMatch 301 /pipecreek2/ /pipe-creek-buffalo-hunts/
RedirectMatch 301 /pipecreek2 /pipe-creek-buffalo-hunts/


RedirectMatch 301 /hollis/ /hollis-farms/
RedirectMatch 301 /hollis /hollis-farms/
RedirectMatch 301 /jakes/ /jakes-rio-grande-outfitting/
RedirectMatch 301 /jakes /jakes-rio-grande-outfitting/
RedirectMatch 301 /abc/ /abc-ranch-ny/
RedirectMatch 301 /abc /abc-ranch-ny/
RedirectMatch 301 /powder/ /powder-river-bowhunts/
RedirectMatch 301 /powder /powder-river-bowhunts/
RedirectMatch 301 /jn/ /jn-ranch/
RedirectMatch 301 /jn /jn-ranch/
RedirectMatch 301 /hidden/ /hidden-valley-outfitters/
RedirectMatch 301 /hidden /hidden-valley-outfitters/
RedirectMatch 301 /elm/ /elm-outfitter-guide-training/
RedirectMatch 301 /elm /elm-outfitter-guide-training/


RewriteEngine on
Options +FollowSymlinks

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# prevent this causing a loop
RewriteCond %{REQUEST_URI} !^sites/
RewriteRule .? sites%{REQUEST_URI} [L]

# If the URI doesn't end with .js and .jpeg and .jpg and .gif and .css or any others
RewriteCond %{REQUEST_URI} !\\.(js|jpe?g|gif|css|swf|html|jsp|ico|png|xml|xsl|rdf|txt|gz|php|shtml|pdf|zip|htm)$ [NC]

# apply transformations

RewriteRule ^([^/]+)$ index.php?pageName=$1 [L]


RewriteCond %{REQUEST_URI} !\\.(js|jpe?g|gif|css|swf|html|jsp|ico|png|xml|xsl|rdf|txt|gz|php|pdf|zip|htm)$ [NC]

RewriteRule ^([^/]+)/([^/]+)$ index.php?pageName=$1&id=$2 [L]

[edit]

Crap, just noticed another error that’s happening … my rewrite (for the site pages) is throwing an internal server error for everything. It seems to work if I move your code after mine but will have to do more testing to make sure.

Dave,

:tup: Test using .htaccess then update the server’s configuration files. You KNOW what you’re doing! :tup:

Right! The “loopy” Redirects can (WILL) cause problems. Note, though, when you change subdirectory names, there is no problem. IMHO, though, you shouldn’t need both the / and non-/ version of the directories as Apache will understand (and add the / if you’re specifying a directory) so the / version should cover both.

Moving mod_rewrite code WILL (as shown above) alter the order of the processing and affect the ultimate redirection. Do the “mod_rewrite walkthrough” with valid and invalid URLs to check what the results should be (then verify with R=301 redirects if you need to confirm your judgment).

Of course, because you have access to the httpd.conf, you also have access to using RewriteMap. I’d setup a RewriteMap for a client to do something much like what you’re doing by creating a script to access a database table for the redirects (for hundreds of pages). If you can “hardwire” using Redirects or RewriteRules in httpd.conf, it’ll be faster but, if that’s too much of a PITA, have a look at RewriteMaps, too, specifically the External Rewriting Program section.

Oh, yeah! I don’t whether to :blush: or :rofl:

Regards,

:magic:

If you don’t have it yet, the first line should be RewriteEngine On, all the rest should work as is :slight_smile:

Dave,

Yes, that should work exactly as I had it … IF mod_rewrite is enabled. Oh, it would be loopy, not 404, if the last RewriteCond was absent.

Regards,

DK

Hmm, is that code ‘literal’, in the sense it should work as is because it’s causing a server error for me

Dave,

mod_alias will do that for you as well as mod_rewrite. If it weren’t for the obvious misdirections that would occur with mod_alias (unless there are no “normal,” i.e., non mini-site subdirectories), your best bet would be to use mod_rewrite to CHECK whether the {REQUEST_FILENAME} exists as a file or directory then (if NOT) internally redirect to the sites subdirectory with the {REQUEST_URI}.

In code terms:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# prevent this causing a [B]loop[/B]
RewriteCond %{REQUEST_URI} !^sites/
RewriteRule .? sites%{REQUEST_URI} [L]

Regards,

DK