KodeFor.Me
KodeFor.Me

Reputation: 13511

htaccess | mod_rewrite | redirect to URL domain parameter

I am migrating an ASP web site into WordPress. Currently, I am fixing the 404 errors, from the old website to the new but I have find a URL that looks like the following

http://www.mysite.com/www.customer-web-site.com

and I like to redirect this domain to

http://www.customer-web-site.com

currently I have use the following rewrite rule, but with no luck:

RewriteRule ^(www\.([^\.]*)\.([a-z]{2,3}))    http://$1    [R=301,L]

but this, redirect me to

http://index.php/

Can somebody help me ?

Kind regards

Upvotes: 1

Views: 102

Answers (1)

Ivan Kolmychek
Ivan Kolmychek

Reputation: 1271

And what about $1 in the rewrite rule? Does changing it to $0 fixes this?

$1 to $9 provide access to the grouped parts (in parentheses) of the pattern, from the RewriteRule which is subject to the current set of RewriteCond conditions. $0 provides access to the whole string matched by that pattern.

Apache mod_rewire doc

Upvotes: 1

Related Questions