This is a discussion on Re: mod_rewrite URL and SEO within the Apache Web Server forums, part of the Web Server and Related Forums category; F'up to: alt.apache.configuration barcin wrote: > I get lost. > > I'd be grateful for help. &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
F'up to: alt.apache.configuration
barcin wrote: > I get lost. > > I'd be grateful for help. > > I only want two rules for my subdomain: > > RewriteRule ^site/([0-9]+),([0-9]+)$ index.php?section=$1&article=$2 > [L] > RewriteRule ^site/([0-9]+)$ index.php?section=$1 [L] > > first is for displaying articles, second for displaying section > content. > > index.php file is in subdomain. > > so my code should look like this: > > Code: > > RewriteCond %{HTTP_HOST} ^sub\.domain\.com [NC] > RewriteRule ^site/([0-9]+),([0-9]+)$ > http://sub.domain.com/index.php?section=$1&article=$2 [L] > > RewriteCond %{HTTP_HOST} ^sub\.domain\.com [NC] > RewriteRule ^site/([0-9]+)$ http://sub.domain.com/index.php?section=$1 > [L] > > but when I request: http://sub.domain.com/site/39 I get message > > The requested URL /site/39 was not found on this server. > > So please, help me, how to write code to make it work > > P.S. > sorry for multiposting but I'm desperate ;( > Is the DocumentRoot of sub.domain.com the same as domain.com? In the .htaccess file try something like this (untested): RewriteCond %{HTTP_HOST} (.*)\.sub\.domain\.com RewriteRule ^site/([0-9]+)(,([0-9]+))?$ index.php?section=$1&article=$3 [L,NS] Also, be sure that this rule is above any similar rules in the file that do not use the RewriteCond statement for it's domain... -- Justin Koivisto, ZCE - justin@koivi.com http://koivi.com |