Forum Moderators: phranque
We hired a developer to accomplish the task, but he left us half way and still cannot reach him. Here's what we're trying to accomplish.
Our site has multiple subdomains which are based around city locations. We want the search results that link to the detail pages to not only write the detail page in a SEF format, but link and display the detail page within it's appropriate subdomain.
The subdomain should not have to be hard defined, whereby we may create other subdomains in the future, and don't want to have to update the .htaccess file.
So if a user searches on the city of "Whistler", the detail page should display under http://whistler.example.com/SEF_URL
Problem is the developer last left off saying the problem is with a 302 redirect which redirects the detail page back to the root directory and not the subdomain directory.
I've pasted the mod rewrite below.
Can anyone help? Keey in mind I'm not very technical here.
The .htaccess file in the root shows the below. Below this, is the .htaccess file used in the subdomain folder.
Root .htaccess
Options +FollowSymLinks
# Disable directory browsing
Options -Indexes
RewriteEngine on
# RewriteBase /
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_NAME} !-f
RewriteCond %{HTTP_HOST} ^(www\.)?whistler\.example\.com$
RewriteRule ^(.*)/([0-9]+)[-/].*.htm$ lease_show.php?Lease=$2 [L,NC]
RewriteRule ^(.*)/([0-9]+)[-/].*.htm$ lease_show.php?Lease=$2 [L,NC]
RewriteRule ^(lease¦BigWhite¦Pemberton¦Whistler¦Squamish¦SunPeaks)/([0-9]+)[-/].*.htm$ lease_show.php?Lease=$2 [L,NC]
RewriteRule ^platinum_leases.htm$ platinum_leases.php [L,NC]
RewriteRule ^featured_leases.htm$ featured_leases.php [L,NC]
RewriteRule ^hot_lease_car.htm$ hot_lease_car.php [L,NC]
Subdomain .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteBase /whistler
RewriteCond %{HTTP_HOST} ^(www\.)?whistler\.example\.com$
RewriteRule ^(.*)/([0-9]+)[-/].*.htm$ lease_show.php?Lease=$2 [L,NC]
# Disable directory browsing
Options -Indexes
RewriteRule ^http://whistler.example.com/lease_show.php?Lease=$2%{QUERY_STRING} http://www.example.com/lease_show.php?Lease=$2%{QUERY_STRING} [L,NC]
# rewriteRule ^foo\.html$ http://www.example.com/index.php
# RewriteRule ^whistler/+(.*)/([0-9]+)[-/].*.htm$ lease_show.php?Lease=$2 [L,NC]
# RewriteRule ^(lease¦BigWhite¦Pemberton¦Whistler¦Squamish¦SunPeaks)/([0-9]+)[-/].*.htm$ lease_show.php?Lease=$2 [L,NC]
Can anyone see the problem or help?
[edited by: jdMorgan at 3:50 pm (utc) on Nov. 24, 2007]
[edit reason] Example.com -- Please see Terms of Service. [/edit]
the rewritecond(s) only apply to the following rewriterule.
the $n's apply to a given rewriterule's matched group(s) (parentheses in the regexp).
the %n's apply to group matches in the rewritecond(s).