0

URLの書き換えと以下のコードの使用を試みています。しかし、以下に示すものを除いて、自分のページで 404 エラーが表示されます。

   Options +FollowSymLinks
   RewriteEngine on

   rewritecond %{http_host} ^phoolwala.net [nc]
   rewriterule ^(.*)$ http://www.phoolwala.net/$1 [r=301,nc]
   #RewriteRule ^index.php?$ /phoolwala.net/? [R=301] 
   RewriteRule ^index.php?$ /? [R=301] 
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d

    #below line gives error in dhtml editor
    #RewriteRule ^(.*)\.html$ $1.php [nc]

    #RewriteRule ^(.*)/$             $1.php [L]


    RewriteRule ^register/$ register.php [L]
    RewriteRule ^register$ register.php [L]


    RewriteRule ^my-account/$ my-account.php [L]
    RewriteRule ^my-account$ my-account.php [L]

    RewriteRule ^track-order/$ track-order.php [L]
    RewriteRule ^track-order$ track-order.php [L]

    RewriteRule ^edit-profile/$ edit-profile.php [L]
    RewriteRule ^edit-profile$ edit-profile.php [L]

    RewriteRule ^testimonials/$ testimonials.php [L]
    RewriteRule ^testimonials$ testimonials.php [L]

    RewriteRule ^sitemap/$ sitemap.php [L]
    RewriteRule ^sitemap$ sitemap.php [L]

    RewriteRule ^login/$ login.php [L]
    RewriteRule ^login$ login.php [L]

    RewriteRule ^my-account/$ my-account.php [L]
    RewriteRule ^my-account$ my-account.php [L]

    RewriteRule ^edit-profile/$ edit-profile.php [L]
    RewriteRule ^edit-profile$ edit-profile.php [L]

    RewriteRule ^reminders/$ reminders.php [L]
    RewriteRule ^reminders$ reminders.php [L]

    RewriteRule ^view-my-orders/$ view-my-orders.php [L]
    RewriteRule ^view-my-orders$ view-my-orders.php [L]

    RewriteRule ^order-details/$ order-details.php [L]
    RewriteRule ^order-details$ order-details.php [L]

    RewriteRule ^contact-us/$ contact-us.php [L]
    RewriteRule ^contact-us$ contact-us.php [L]

    RewriteRule ^logout/$ logout.php [L]
    RewriteRule ^logout$ logout.php [L]

    RewriteRule ^cart/$ cart.php [L]
    RewriteRule ^cart$ cart.php [L]


     RewriteRule ^international-products/(.*)/(.*)/(.*)/ international-products.php?cid=$1&id=$2&pageno=$3 [L]
     RewriteRule ^international-products/(.*)/(.*)(.*)/ international-products.php?cid=$1&id=$2&pageno=$3 [L]

    RewriteRule ^products/(.*)/(.*)/ products.php?id=$1&pageno=$2 [L]
    RewriteRule ^products/(.*)/(.*) products.php?id=$1&pageno=$2 [L]

    RewriteRule ^price/(.*)/(.*)/(.*)/ productsprice.php?from=$1&to=$2&pageno=$3 [L]
    RewriteRule ^price/(.*)/(.*)(.*)/ productsprice.php?from=$1&to=$2&pageno=$3 [L]

    RewriteRule ^page/(.*)/(.*)/ page.php?alias=$1&id=$2 [L]
    RewriteRule ^page/(.*)/(.*) page.php?alias=$1&id=$2 [L]

    RewriteRule ^international-product/(.*)/(.*)/(.*)/ international-product-details.php?cid=$1&cat=$2&id=$3 [L]
    RewriteRule ^international-product/(.*)/(.*)/(.*) international-product-details.php?cid=$1&cat=$2&id=$3 [L]

    RewriteRule ^product/(.*)/(.*)/(.*)/ product-details.php?cat=$1&alias=$2&id=$3 [L]
    RewriteRule ^product/(.*)/(.*)/(.*) product-details.php?cat=$1&alias=$2&id=$3 [L]

    RewriteRule ^search/(.*)/(.*)/(.*)/ productsearch.php?keyword=$1&cat=$2&pageno=$3 [L]
    RewriteRule ^search/(.*)/(.*)(.*)/ productsearch.php?keyword=$1&cat=$2&pageno=$3 [L]

    RewriteRule ^international/(.*)/ international.php?cid=$1 [L]
    RewriteRule ^international/(.*) international.php?cid=$1 [L]

しかし、以下のコードを除いて何も機能していません。コードを更新するのを手伝ってください。

  RewriteRule ^product/(.*)/(.*)/(.*)/ product-details.php?cat=$1&alias=$2&id=$3 [L]
  RewriteRule ^product/(.*)/(.*)/(.*) product-details.php?cat=$1&alias=$2&id=$3 [L]
4

1 に答える 1

0

返信が遅くなり申し訳ありません。今日、私も同じ問題に直面しており、あなたと共有したい解決策を得ました。

私はPHPの初心者なので、それが正しいかどうかはわかりません。

products.php?id=15&pageno=2 and I require products/15/2

私のページ名の1つがproducts.phpでもあることがわかったため、これproducts/15/2をに変更して正常に機能したため、エラーが発生product-detail/15/2していました!!!

つまり、すでにページの名前になっているキーワードを htaccess ルールで宣言しないでください。そう思います :)

ありがとう

于 2012-12-03T19:35:21.333 に答える