开发者

.htaccess cant pass variables to rewrited page on WAMP

开发者 https://www.devze.com 2023-01-05 18:05 出处:网络
I was coding few php pages to display customer quotations, on rep.php, user can click view details button (POST quoteID as the variable to quotedetails.php?quoteID=Q123456) to view the detailed info a

I was coding few php pages to display customer quotations, on rep.php, user can click view details button (POST quoteID as the variable to quotedetails.php?quoteID=Q123456) to view the detailed info about a particular quote.

Then I use .htaccess to make all php pages to html extention and rewrited url from 'quotedetails.php?quoteID=Q123456' to 'quotedetails/Q123456.html', everything works fine on XAMPP, but under WAMP, rewrited url does not display the data on that quotedetail page, i tested by using old url (quotedetails.php?quoteID=Q123456), it works fine, so I guess it must be something wrong with my .htaccess rules as the new html url cannot pass the variable (quoteID).

this is my .htaccess file:

Options +FollowSymlinks
Re开发者_如何学编程writeEngine on

#sideBar.php edit rep link with the styles below, e.g. all,all.html (showing all)
#or reps/$repID,$repName.html
RewriteRule ^reps/all,all.html$ rep.php?repID=all&repName=all [QSA]   
RewriteRule ^reps/([A-Z]+),([A-Za-z\sA-Za-z]+).html$ rep.php?repID=$1&repName=$2 [QSA]
RewriteRule ^reps/([A-Z]+).html$ rep.php?repID=$1 [QSA]

#rep.php including page string, edit pager links in rep.php with following styles,
#\s indicating a white space therefore mod_rewrite can recognise the repName
#e.g. reps/$repID,$repName,$page.html
RewriteRule ^reps/([A-Za-z]+),([A-Za-z\sA-Za-z]+),([0-9]+).html$ rep.php?repID=$1&repName=$2&page=$3 [QSA]


#quotedetails.php rewrite this page url to Q99999.html
#e.g. quotedetails/$quoteID.html
RewriteRule ^quotedetails/(Q[0-9]+).html$ /quotedetails.php?quoteID=$1 [QSA]

#index/addquote/search/viewall/howto page rewrite *.php ---> *.html
RewriteRule ^index.html$ index.php [QSA]   
RewriteRule ^addquote.html$ addquote.php [QSA]   
RewriteRule ^search.html$ search.php [QSA]   
RewriteRule ^viewall.html$ viewall.php [QSA]   
RewriteRule ^customer.html$ customer.php [QSA]   
RewriteRule ^addcustomer.html$ addcustomer.php [QSA] 
RewriteRule ^howto.html$ howto.php [QSA]
RewriteRule ^nice404.html$ nice404.php [QSA]

ErrorDocument 404 /auma_quotes/nice404.html


RewriteRule ^quotedetails/(Q[0-9]+).html$ /quotedetails.php?quoteID=$1 [QSA] is the wrong way around isnt it? it should be RewriteRule pattern match, so

RewriteRule ^quotedetails.php?quoteID=(Q[0-9]+)$ quotedetails/$1.html [QSA]

Hope this helps

Luke

0

精彩评论

暂无评论...
验证码 换一张
取 消