问题描述
我正在尝试更改我的网址的域,父网址类似于
http://abc.def.com/123123132/abcvalue
RewriteCond %{HTTP_HOST} ^abc\.def\.com$
RewriteRule ^(.*)$ https://efg.com/dd/as/$1 [L]
这正在更改域,但它也将旧域放入新 url 中。类似的东西
https://efg.com/dd/as/http://abc.def.com/123123132/abcvalue
需要这方面的帮助。谢谢
编辑:- 完整的 htaccess 是
# PHP -- BEGIN cPanel-generated handler,do not edit
# Set the “ea-PHP74” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-PHP74 .PHP .PHP7 .phtml
</IfModule>
# PHP -- END cPanel-generated handler,do not edit
RewriteEngine On
#### PrintNinja unique redirects
RewriteCond %{HTTP_HOST} ^printninja.com$ [NC]
RewriteRule ^learn/(.*) /printing-resource-center/ [NC,L,R=301]
RewriteRule ^digital-downloads/(.*) /printing-resource-center/ [NC,R=301]
RewriteRule ^resources/(.*) /printing-resource-center/ [NC,R=301]
RewriteRule ^pricing\/(.*)$ https://printninja.com/calculator/$1 [L]
#### Begin Uploader rewrites
# printingupload.com/files-submited/* --redirect to -> https://printninja.com/calculator/files-submited/*
RewriteCond %{HTTP_HOST} ^(www\.)?printingupload\.com$
RewriteRule ^printingupload\.com/files-submited\/(.*)$ https://printninja.com/calculator/files-submited/$1 [L]
# printingupload.com/invalid-order/* --redirect to -> https://printninja.com/calculator/invalid-order/*
RewriteCond %{HTTP_HOST} ^(www\.)?printingupload\.com$
RewriteRule ^printingupload\.com/invalid-order\/(.*)$ https://printninja.com/calculator/invalid-order/$1 [L]
# printingupload.com/* --redirect to -> https://printninja.com/calculator/products/upload_proofing/* (this rule must appear after the other printingupload.com/* rules)
RewriteCond %{HTTP_HOST} ^(www\.)?printingupload\.com$
RewriteRule ^printingupload\.com\/(.*)$ https://printninja.com/calculator/products/upload_proofing/$1 [L]
# submit.printingupload.com/* --redirect to -> https://printninja.com/calculator/submit_proofing/*
RewriteCond %{HTTP_HOST} ^submit\.printingupload\.com$
RewriteRule ^submit\.printingupload\.com\/(.*)$ http://printninja.com/calculator/submit_proofing/$1 [L]
# proofs.printingupload.com/approved/* --redirect to -> https://printninja.com/calculator/status/approved/*
RewriteCond %{HTTP_HOST} ^proofs\.printingupload\.com$
RewriteRule ^approved\/(.*)$ https://printninja.com/calculator/status/approved/$1 [L]
# proofs.printingupload.com/rejected/* --redirect to -> http://staging.printninja.com/calculator/status/rejected/*
RewriteCond %{HTTP_HOST} ^proofs\.printingupload\.com$
RewriteRule ^rejected\/(.*)$ https://printninja.com/calculator/status/rejected/$1 [L]
# proofs.printingupload.com/* --redirect to -> http://staging.printninja.com/calculator/rackfile/*
RewriteCond %{HTTP_HOST} ^proofs\.printingupload\.com$
RewriteRule ^(.*)$ https://printninja.com/calculator/rackfile/$1 [L]
解决方法
按照以下方式创建您的 htaccess 规则文件,请确保在测试您的 URL 之前清除浏览器缓存。
# php -- BEGIN cPanel-generated handler,do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler,do not edit
RewriteEngine On
#### PrintNinja unique redirects
RewriteCond %{HTTP_HOST} ^proofs\.printingupload\.com$ [NC]
RewriteRule ^(.*)/?$ https://printninja.com/calculator/rackfile/$1 [R=301,NE,L]
RewriteCond %{HTTP_HOST} ^printninja.com$ [NC]
RewriteRule ^learn/(.*) /printing-resource-center/ [NC,L,R=301]
RewriteRule ^digital-downloads/(.*) /printing-resource-center/ [NC,R=301]
RewriteRule ^resources/(.*) /printing-resource-center/ [NC,R=301]
RewriteRule ^pricing\/(.*)$ https://printninja.com/calculator/$1 [L]
#### Begin Uploader rewrites
# printingupload.com/files-submited/* --redirect to -> https://printninja.com/calculator/files-submited/*
RewriteCond %{HTTP_HOST} ^(www\.)?printingupload\.com$
RewriteRule ^printingupload\.com/files-submited\/(.*)$ https://printninja.com/calculator/files-submited/$1 [L]
# printingupload.com/invalid-order/* --redirect to -> https://printninja.com/calculator/invalid-order/*
RewriteCond %{HTTP_HOST} ^(www\.)?printingupload\.com$
RewriteRule ^printingupload\.com/invalid-order\/(.*)$ https://printninja.com/calculator/invalid-order/$1 [L]
# printingupload.com/* --redirect to -> https://printninja.com/calculator/products/upload_proofing/* (this rule must appear after the other printingupload.com/* rules)
RewriteCond %{HTTP_HOST} ^(www\.)?printingupload\.com$
RewriteRule ^printingupload\.com\/(.*)$ https://printninja.com/calculator/products/upload_proofing/$1 [L]
# submit.printingupload.com/* --redirect to -> https://printninja.com/calculator/submit_proofing/*
RewriteCond %{HTTP_HOST} ^submit\.printingupload\.com$
RewriteRule ^submit\.printingupload\.com\/(.*)$ http://printninja.com/calculator/submit_proofing/$1 [L]
# proofs.printingupload.com/approved/* --redirect to -> https://printninja.com/calculator/status/approved/*
RewriteCond %{HTTP_HOST} ^proofs\.printingupload\.com$
RewriteRule ^approved\/(.*)$ https://printninja.com/calculator/status/approved/$1 [L]
# proofs.printingupload.com/rejected/* --redirect to -> http://staging.printninja.com/calculator/status/rejected/*
RewriteCond %{HTTP_HOST} ^proofs\.printingupload\.com$
RewriteRule ^rejected\/(.*)$ https://printninja.com/calculator/status/rejected/$1 [L]
# proofs.printingupload.com/* --redirect to -> http://staging.printninja.com/calculator/rackfile/*