View Full Version : .htaccess in Primary Domain - tweak to leave Add-Ons alone - how?
scanreg
03-14-2008, 07:01 AM
I have a Primary domain plus some Add-On domains
/public_html/ (primary domain)
/public_html/add-on-A/
/public_html/add-on-B/
I need to tweak the .htaccess of the Primary domain to skip over the Add-On domains so that the primary .htaccess doesn't fool with the behavior of the Add-Ons
Turns out that a script that I'd like to use in the Primary domain uses .htaccess in a way that by default affects all subdirectories.
I'm wondering if there is a way to adjust the primary .htaccess so that it bypasses specified subdirs
/public_html/ (primary domain)
/public_html/add-on-A/ (primary .htaccess leaves alone)
/public_html/add-on-B/ (primary .htaccess leaves alone)
Is this possible? Any suggestions?
Many thanks :)
Basil
03-14-2008, 10:29 AM
Put "rewritecond %{http_host} ^(www\.)?maindomain\.com$ [nc]" before the rules to limit them to a particular domain.
scanreg
03-14-2008, 11:52 AM
Thanks, I gave it a try, but no luck. Here's the full .htaccess plus the new rewritecond (near top). I also tried putting the new rewritecond at the very top (above RewriteEngine on) but that too generated a 404:
# enable mod_rewrite
RewriteEngine on
rewritecond %{http_host} ^(www\.)?maindomain\.com$ [nc] ## - skip add-on domains
# correct urls for yahoo bot
RewriteCond %{REQUEST_URI} !\..+$
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
# mod_rewrite rules for categories pages
RewriteRule ^(.*)/$ index.php?category=$1 [QSA,L]
RewriteRule ^(.*)/index([0-9]+).html$ index.php?category=$1&page=$2 [QSA,L]
# mod_rewrite rule for suggest link page
RewriteRule ^suggest-link([0-9]+).html$ suggest-link.php?id=$1 [QSA,L]
# mod_rewrite rule for suggest link page
RewriteRule report-link.php$ report-link.php [QSA,L]
RewriteRule ^([a-z]+)-links.html$ listings.php?view=$1 [QSA,L]
RewriteRule ^([a-z]+)-links([0-9]+).html$ listings.php?view=$1&page=$2 [QSA,L]
# mod_rewrite rules for view link page
RewriteRule ^([^/]+)-l([0-9]+).html$ view-link.php?cat=&title=$1&id=$2 [QSA,L]
RewriteRule ^(.*)/([^/]+)-l([0-9]+).html$ view-link.php?cat=$1&title=$2&id=$3 [QSA,L]
# mod_rewrite rules for news page
RewriteRule ^(.*)-n([0-9]+).html$ news.php?title=$1&id=$2 [QSA,L]
RewriteRule ^news.html$ news.php [QSA,L]
RewriteRule ^news([0-9]+).html$ news.php?page=$1 [QSA,L]
# mod_rewrite rules for additional pages
RewriteRule ^p(.*).html$ page.php?name=$1 [QSA,L]
# mod_rewrite rules for error pages
RewriteRule ^([0-9]+).htm$ error.php?error=$1 [QSA,L]
# mod_rewrite rules for suggest link page
RewriteRule ^suggest-link-([0-9]+).html$ suggest-link.php?id=$1 [QSA,L]
# mod_rewrite rules for suggest category page
RewriteRule ^suggest-category-([0-9]+).html$ suggest-category.php?id=$1 [QSA,L]
# Google Sitemap
RewriteRule ^sitemap.xml$ google-sitemap.php [QSA,L]
# Yahoo site feed
RewriteRule ^urllist.txt$ yahoo-feed.php [QSA,L]
ErrorDocument 500 500.htm
ErrorDocument 404 404.htm
ErrorDocument 403 403.htm
ErrorDocument 401 401.htm
Basil
03-15-2008, 03:14 AM
Every time it comes to an [L] flag, it clears all of the previous conditions. In your situation it might be easier to just override the htaccess file with another one. You can place something like "rewriteengine off" in a .htaccess file in whatever directory you want to prevent from inheriting rules.
scanreg
03-15-2008, 07:22 AM
I'd be using a rewrite thing in the subdir Joomla apps, too
Could I add the skip-subdir-rule above each instance of [L] like so:
# enable mod_rewrite
RewriteEngine on
rewritecond %{http_host} ^(www\.)?maindomain\.com$ [nc] ## - skip add-on domains
# correct urls for yahoo bot
RewriteCond %{REQUEST_URI} !\..+$
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
# mod_rewrite rules for categories pages
rewritecond %{http_host} ^(www\.)?maindomain\.com$ [nc]
RewriteRule ^(.*)/$ index.php?category=$1 [QSA,L]
rewritecond %{http_host} ^(www\.)?maindomain\.com$ [nc]
RewriteRule ^(.*)/index([0-9]+).html$ index.php?category=$1&page=$2 [QSA,L]
I know it's clunky but if it works that would be okay
Thanks :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.