I recently setup a CMS for one of the sites and it uses a directory-level .htaccess file:
- Code: Select all
### SILVERSTRIPE START ###
RewriteEngine On
RewriteBase /wavs2
RewriteCond %{REQUEST_URI} !(^/wavs2$)|(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
### SILVERSTRIPE END ###
Using this setup, I can get to the site just fine using the direct url of www.unclebubby.com/wavs2. If I try using the subdomain, wav.unclebubby.com, I get a 404 page.
If I change the RewriteBase from /wavs2 to /, the problem reverses (essentially) and the subdomain works but direct entry doesn't.
Is there a way to set the RewriteBase based on what URL the user types into the browser? That way, I could say If they type the direct URL, set the base to /wavs2. Otherwise, if they type the subdomain URL, set the base to /. Or am I stuck with one or the other?
If you have any other suggestions for accomodating either URL, I'm open to it. I've been tearing my brain out over this one for three days.
Thanks,
Joe