HTACCESS将子站点重定向到主站点

时间:2016-07-06 12:19:55

标签: php html .htaccess redirect mod-rewrite

我的.htaccess是我的.co.uk网站。我在目录中有2个语言sties .pl文件夹/ language / pl .fr文件夹/语言/ fr 这些都会影响网站中的链接。我可以阻止我的外语网站中的页面受到影响。

   Options +Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.co.uk [NC]
RewriteRule ^(.*)$ http://www.mysite.co.uk/$1 [L,R=301]



redirect /oil.html http://www.mysite.co.uk/Oils/Pages/ind_oils.html
redirect /honing.html http://www.mysite.co.uk/Pages/mandrels.html
redirect /toolingabrasives/heavyduty.html http://www.mysite.co.uk/Pages/HD-super-tooling.html
redirect /europe.html http://www.mysite.co.uk/Pages/Misc/distributors.html
redirect /toolingabrasives/horizontal.html http://www.mysite.co.uk/Pages/mandrels.html
redirect /mysite_honing.htm http://www.mysite.co.uk/index.html
redirect /honing_abrasives.htm http://www.mysite.co.uk/index.html 
redirect /Oils/Pages/extra.html http://www.mysite.co.uk/Oils/Pages/oil_pages/extra.html
redirect /pages/misc/contact_us.html http://www.mysite.co.uk/pages/misc/contact_form.html
redirect /abrasives/PDF/ http://www.mysite.co.uk/PDF/abrasives-tooling/
Redirect 301 /Pages/ http://www.mysite.co.uk/pages/
Redirect 301 /pages/Machines/ http://www.mysite.co.uk/pages/machines/
Redirect 301 /Oils/ http://www.mysite.co.uk/oils/
Redirect 301 /Oils/Pages/ http://www.mysite.co.uk/oils/pages/
Redirect 301 /oils/Pages/ http://www.mysite.co.uk/oils/pages/
Redirect 301 /pages/Misc/ http://www.mysite.co.uk/pages/misc/
Redirect 301 /pages/NewsPages/ http://www.mysite.co.uk/pages/newspages/
Redirect 301 /pages/Services/ http://www.mysite.co.uk/pages/services/
Redirect 301 /Abrasives/Pages/ http://www.mysite.co.uk/abrasives/pages/
Redirect 301 /abrasives/Pages/ http://www.mysite.co.uk/abrasives/pages/
redirect /pages/brochure_honing_tooling.html http://www.mysite.co.uk/pages/brochure_honing_machines.html
redirect /pages/honing_tooling.html http://www.mysite.co.uk/pages/honing-tooling.html
Redirect /pages/brochure_grinding.html http://www.mysite.co.uk/pages/brochure_honing_machines.html
redirect /pages/privicy.html http://www.mysite.co.uk/pages/misc/privacy.html
redirect /pages/news/news.html http://www.mysite.co.uk/pages/newspages/news.html
redirect /pages/oil/extra.html http://www.mysite.co.uk/oils/pages/oil_pages/extra.html
redirect /pages/about_us.html http://www.mysite.co.uk/pages/misc/about.html
redirect /pages/misc/privicy.html http://www.mysite.co.uk/pages/misc/privacy.html
redirect /abrasives/pages/sectors/steel.html http://www.mysite.co.uk/abrasives/pages/steel-industry.html
redirect 301 /pages/Oils/oils.html http://www.mysite.co.uk/oils/index.html
redirect 301 /PDF/New_Vertical_Brochure.pdf http://www.mysite.co.uk/PDF/tooling/New_Vertical_Brochure.pdf
redirect 301 /PDF/Mandrels_Accessories_Brochure_1.pdf http://www.mysite.co.uk/PDF/tooling/Mandrels_Accessories_Brochure_1.pdf
redirect 301 /pages/brochures_machines.html http://www.mysite.co.uk/pages/brochure_honing_machines.html
redirect 301 /pages/machines/e2000-xl.html http://www.mysite.co.uk/pages/machines/e2000xl.html


ErrorDocument 404 "/404//http-error.cgi"
ErrorDocument 500 "/404//http-error.cgi"

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>

0 个答案:

没有答案