Forum Moderators: phranque
I have 2 domains. Domain one is my primary, and domain two is a subdirectory of domain 1, with a redirect to the subdomain.
The problem is that on domain2, ALL requests for pages go to the index.php page. this is usually fine, unless i'm trying to leave a sitemap for google to pickup, or if i want to be able to manually open a HTML page in the domain - since EVERYTHING gets directed to index.php i cant do this currently.
here is my .htaccess from domain1 (domain1 stuff left out, just the redirect part)
RewriteBase /
RewriteCond %{HTTP_HOST} domain2.com
RewriteCond %{REQUEST_URI}!domain2/
RewriteRule ^(.*)$ domain2/$1 [L]
and this is what's in domain2's .htaccess
<Files Settings.php>
Deny from all
</Files>
it's my understanding that the code i posted above simply redirects any incoming requests to domain2.com to the /domain2 folder, which has index.php set as the default.
all i need is a conditional statement that says something like:
IF you want domain2.com/sitemaps/sitemap.php, then go directly to /domain2.com/sitemaps/sitemap.php
ELSE send everything to domain2.com/index.php
at least now i understand what it is i really need.. i just need help with the syntax - which seems like it would be easy..
I got close by adding this in front of the current RewriteCond statements:
RewriteCond %{HTTP_HOST} domain2.com
RewriteCond %{REQUEST_URI}!domain2/sitemaps/
RewriteRule ^(.*)$ domain2/sitemaps/sitemaps.php$1 [L]
but this ended up sending EVERYTHING to /sitemaps.php
i think i'm close.. i guess i just need help with the syntax..
RewriteBase /
RewriteCond %{HTTP_HOST} domain2\.com
RewriteCond %{REQUEST_URI} [b]!^/do[/b]main2/
RewriteRule ^(.*)$ domain2/$1 [L]
RewriteBase /
RewriteCond %{HTTP_HOST} domain2\.com
RewriteCond [b]$1 [i][/i]!^do[/b]main2/
RewriteRule (.*) /domain2/$1 [L]
Jim
i guess i failed to mention that i also need to open a file in a subdirectory also..
NOW if i open say, [mysite...] it opens (it would not before)
but i also need to open [mysite...]
when i try this, i just get my index page (like before)
I assume i need another entry in .htaccess that specifies this, but of course i'm clueless on how to do it..
To avoid being obtuse, I should note that our purpose here is to help you learn, and not to write your code for you. We simply don't have enough contributing member volunteers in this forum to meet the global demand for free code... ;)
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim
ok.. sounded simple enough.. here is what i tried:
RewriteBase /
RewriteCond %{HTTP_HOST} mysite.com
RewriteCond %{REQUEST_URI}!^/mysite/
RewriteCond %{REQUEST_URI}!^/mysite/sitemaps/
RewriteRule ^(.*)$ bigbraggers/$1 [L]
(also tried!^mysite/sitemaps/sitemaps.php )
and still, all i get is my index page.. however, if i access it this way:
[mysite.com...] it works
Note the double mysite, which doesnt really exist - the actual path is : ..primarysite/htdocs/mysite/sitemaps
my eyes are bleeding from reading the apache documentation - am i doing it wrong, or is something else fubar'd?