Rewriterule questions


#1

I am attempting to redirect requests to my domain name, michaelshick.com to the subdirectory /site. I am doing this so that I can use WebDAV to manage my site files. Still, I want to be able to have other directories directly off of the michaelshick.com directory, such as michaelshick.com/blog.

Is there a way I have all requests made to michaelshick.com redirected to /site but maintain /blog in it’s current location? That is to say, I don’t want to have to move /blog to michaelshick.com/site/blog in order for it to remain accessible with the redirect in place.


#2

RewriteBase /
RewriteCond %{REQUEST_URI} !^/site
RewriteCond %{REQUEST_URI} !^/blog
RewriteRule (.*) /site/$1 [R]

See the documentation for an explanation: URL Rewriting Engine

:cool: Perl / MySQL / HTML+CSS


#3

What about just redirecting the pages like so:
(Place the following in a .htaccess file)
Redirect permanent index.html http://subdomain.example.com/index.html

Silk


#4

Thank you, that worked like a charm for most of my directories–with one exception.

I have a another WebDAV enabled directory, /dropbox, exisiting at the same level as the others. This directory was password protected (for read) and loading it would bring up a password prompt.

With the rewrite functioning firefox simply says “Firefox has detected that the server is redirecting the request for this address in a way that will never complete.” I can still access the directory as a web folder, and if I turn off the “password protect this directory” option in DH control panel I am able to access/read the directory with no problems.

Is there any way to preserve the password protection with a rewrite in place?


#5

Add a RewriteCond for /dropbox

:cool: Perl / MySQL / HTML+CSS