Forum Moderators: phranque
I've got:
RewriteRule ^Merchant2/merchant.mvc?Screen=PROD&Product_Code=([A-Za-z0-9_-]+)$ /mm5/merchant.mvc?Screen=PROD&Product_Code=$1 I'm sure I've got to just have a simple problem, but I can't figure it out. Also I can't just redirect all requests to Merchant2, I just need it for this specific type of link.
I've looked at this post, but it didn't seem to answer my question: [webmasterworld.com...]
Thanks in advance for your help.
Dustin
RewriteCond %{QUERY_STRING} ^Screen=PROD&Product_Code=([A-Za-z0-9_\-]+)$
RewriteRule ^Merchant2/merchant.mvc$ /mm5/merchant.mvc?Screen=PROD&Product_Code[b]=%1[/b] [L]
Jim
Thanks for the reply, but when I added that the whole site started throwing up 500 errors. Do I have it placed incorrectly in the file possible? Here's my full code:
DirectoryIndex /mm5/merchant.mvc?
ErrorDocument 404 http://www.example.com/store/error.html
ErrorDocument 403 http://www.example.com/store/error.html
Redirect /status https://www.example.com/mm5/merchant.mvc?Screen=OLST
Redirect /p/ http://www.example.com/mm5/merchant.mvc?Screen=PROD&Product_Code=
Redirect /c/ http://www.example.com/mm5/merchant.mvc?Screen=CTGY&Category_Code=
Redirect /s/ http://www.example.com/mm5/merchant.mvc?Screen=SRCH&Search=
Redirect /sc/ http://www.example.com/mm5/merchant.mvc?Screen=
Redirect /gh http://www.example.com/mm5/merchant.mvc?Screen=PROD&Affiliate=gh&Product_Code=HANDYBAR
Redirect /ez http://www.example.com/mm5/merchant.mvc?Screen=PROD&Affiliate=ez&Product_Code=KE100
RewriteEngine On
RewriteCond %{QUERY_STRING} ^Screen=PROD&Product_Code=([A-Za-z0-9_\-]+)$
RewriteRule ^Merchant2/merchant.mvc$ /mm5/merchant.mvc?Screen=PROD&Product_Code=%1 [L]
RewriteRule ^store/([A-Za-z0-9_-]+)-p-([^.]+)\.html$ /mm5/merchant.mvc?Screen=PROD&Product_Code=$1&Category_Code=$2
RewriteRule ^store/([A-Za-z0-9_-]+)\.html$ /mm5/merchant.mvc?Screen=USL&Code=$1 [T=application/x-httpd-mv]
RewriteRule ^site/([A-Za-z0-9_-]+)\.html$ /mm5/merchant.mvc?Screen=USL&Code=$1 [T=application/x-httpd-mv]
RewriteRule ^site/prods/([A-Za-z0-9_-]+)\.html$ /mm5/merchant.mvc?Screen=SRCH&Search=$1 [T=application/x-httpd-mv]
All the redirects in the beginning of the file are leftover from a while ago and we've left them there because a few people still use the old links.
Thanks for your help.
Dustin
Also, be aware that your ErrorDocument directives will both produce 302-redirects, instead of returning the correct server error status. This is a serious problem if you're trying to rank is search engines. Use:
ErrorDocument 404 /store/error.html
ErrorDocument 403 /store/error.html
Jim
The 'flag' being referred to is one of the RewriteRule or RewriteCond flags, as denoted by [f] at the right end of the line -- for example, [L] or [T=application/x-httpd-mv]. The delimiter for this flag is the space that precedes it. The only other spaces allowed in the line are the one after the directive (e.g. RewriteRule) and the one after the regular-expressions pattern. So, you get three spaces per line, basically. No space should follow [f], either.
If you were to type "Product_Code" as "Product Code" in a regex pattern, it would cause this problem.
If you can test on an off-line server, try commenting-out each line in turn by putting a "#" in front of it. This would help narrow down the problem.
Jim