0

この URL を別のサブドメインにリダイレクトしようとしていますが、404 が返されます。

リダイレクトする必要があります:

www.dustystrings.com/instrumentbuilding / XYZ

ここまで:

Manufacturing.dustystrings.com/instrumentbuilding / XYZ

あるサーバーにwww.dustystrings.comがあり、別のサーバーにmanufacturing.dustystrings.comがあります(必要)。

基本的に、すべての www.dustystrings.com/instrumentbuilding/ クエリを Manufacturing.dustystrings.com/instrumentbuilding/ にリダイレクトしたいと考えています。

これを行うための正しい .htacess 301 コードは何ですか? (アパッチサーバー)

4

2 に答える 2

0

これは機能するはずです:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.dustystrings.com[nc]
RewriteRule ^.*/instrumentbuilding/(.*)$ http://manufacturing.dustystrings.com/instrumentbuilding/$1 [r=301,nc]
于 2012-09-05T17:18:35.313 に答える
0

htaccess リダイレクトを使用して www にリダイレクトします。

以下のコードで .htaccess ファイルを作成します。これにより、domain.com に着信するすべてのリクエストが www.domain.com にリダイレクトされるようになります。.htaccess ファイルは、古い Web サイトのルート ディレクトリに配置する必要があります (つまり、インデックスファイルが置かれているディレクトリと同じ)

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Please REPLACE domain.com and www.newdomain.com with your actual domain name.

注* このリダイレクトの .htaccess メソッドは、Apache Mod-Rewrite モジュールが有効になっている Linux サーバーでのみ機能します。

于 2012-09-05T17:26:53.287 に答える