私は、国別のURLを含むウェブサイトを作成し、よりターゲットを絞って分けるためのプロジェクトに取り組んでいます。/domain.comをして、このファイルのindex.php国別のサブディレクトリURLの.htaccess URLの書き換えに関するヘルプが必要
オープンdomain.com/us/を読んで、(このファイルcountry.phpを読む -
オープンを:ここで
は、私が何をしたいです私たち/それは/ de// in/uk /のように何でもかまいません。要求に基づいて動的に生成された国コードを意味します。
open domain.com/us/free-free-free-ad1965.htmlデータベースからid 1965のウェブサイトに投稿してください。そのため、ad.phpファイルを読むべきです。
ここ
をdomain.com/us/xyzに適用され、それが404エラーを与えると同じ404.phpファイルを読み込む必要があります存在しないオープンdomain.com/xyzが私の現在のhtaccessのコードであれば:このhtaccessのオプション1を適用した後
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
RewriteRule ^(.*)/ country.php?countrycode=$1 [NC]
RewriteRule ^(.*)/(.*)-ad(.*).html ad.php?countrycode=$1&post=$2&id=$3 [NC]
RewriteRule ^maintenance\.html$ maintenance.php [NC,L]
RewriteRule ^submit\.html$ submit.php [NC,L]
RewriteRule ^privacy\.html$ privacy.php [NC,L]
RewriteRule ^terms\.html$ terms.php [NC,L]
RewriteRule ^contact\.html$ contact.php [NC,L]
ErrorDocument 400 /404.php
ErrorDocument 401 /404.php
ErrorDocument 403 /404.php
ErrorDocument 404 /404.php
ErrorDocument 500 /404.php
は罰金毎回とオプション2 4は、それぞれ他の人と競合して動作します。 4つのオプションはすべて別々のものであり、お互いに協力し合う必要があります。
どうすればいいですか?
私はそれを試しましたが運はありません。 'http://www.domain.com/country.php/?countrycode = country.php'と' http:// www。domain.com/us/'を要求するときに、 domain.com/us/free-free-free-ad1965.html'エラーが表示される:ページが正しくリダイレクトされない Firefoxは、サーバーがこのアドレスの要求を決して完了しない方法でリダイレクトしていることを検出しました。 –
私は今、その問題は、301のリダイレクトコードライン私はその位置を変更し、現在の作業を変更したと思う。 RewriteRule ^(。*)/ $。[L、R = 301] '' RewriteRule ^(。*)/ [。NC] ' ' RewriteRule ^(。*)/ $ country.php?countrycode = $ 1 [NC] '(*。) - ad(。*).html ad.php?countrycode = $ 1&post = $ 2&id = $ 3 –