我正在尝试进行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]
答案 0 :(得分:0)
很抱歉迟到的回复,今天我也面临同样的问题,我得到了一个我想与你分享的解决方案。
不知道它是否正确,因为我是PHP的初学者。
products.php?id=15&pageno=2 and I require products/15/2
我收到错误是因为我发现我的一个页面名称也是products.php,当我将此products/15/2
更改为product-detail/15/2
时它运行良好!!!
所以这意味着不要在htaccess规则中声明已经是页面名称的关键字。我想是这样:))
由于