user691146
user691146

Reputation:

htaccess in subdomain

Once again facing the htaccess issue with subdomain.

The url for subdomain is http://m.domain.co.uk which redirects from http://www.domain.co.uk/m

Now the main site's index file is under /m/webstores/ecommerce/.

In that index file the link for the product is shopping-cart/293/test where 293 is the product id and test is product name.

Now the htaccess code is:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST}%{REQUEST_URI}   ^(www\.)?domain.co.uk/webstores/ecommerce/(.*)
RewriteRule  (.*)  http://m.domain.co.uk/%1  [R=301,L]
RewriteRule ^(\d+)/([^/]+)/?$ /shopping-cart/index.php?uiid=$1&title=$2 [L]

The htaccess file is located under /m/webstores/ecommerce/.

The above code is detecting the subdomain correctly ie http://m.domain.co.uk/webstores/ecommerce/ but not the product url.

Please suggest what's the wrong I am doing.

Upvotes: 0

Views: 1131

Answers (1)

Wige
Wige

Reputation: 3918

RewriteRule (.*) http://m.domain.co.uk/%1 [R=301,L]

should be

RewriteRule (.*) http://m.domain.co.uk/$1 [R=301,L]

$1 not %1 - you would be redirecting to http://m.domain.co.uk/www.

Upvotes: 1

Related Questions