1

I need to 301 redirect all ?print=yes URLs to the URLs without ?print=yes that contain the same name in them through .htaccess. Currently the button to PRINT is present in the header of the website so it's more than 70 URLs to fix... Removing the button to PRINT the page will ruin the design quite a bit, so it's not really an option.

I think it needs to be a RedirectMatch rule, but how do I write it?

Example: redirect 301 from domain.com/faq/?print=yes to domain.com/faq

Thanks in advance!

4

2 に答える 2

1

mod_rewriteと.htaccessを有効にしてからhttpd.conf、次のコードを.htaccessアンダーDOCUMENT_ROOTディレクトリに配置します。

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} ^print=yes$ [NC]
RewriteRule ^ %{REQUEST_URI}? [R=301,L,NE]
于 2013-02-19T07:45:14.860 に答える
0

リダイレクトで同じことができるかどうかはわかりませんが、リライトでどのように行うかを次に示します。

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\?print=yes$ $1 [NC]
于 2013-02-19T07:00:34.480 に答える