URL重定向如果包含单词

时间:2015-12-17 00:42:14

标签: php apache .htaccess mod-rewrite redirect

我如何根据htaccess重定向包含特定单词的所有网址

例如:

http://videos.showtime.com.ph/its-showtime-hashtag-boys-macho-dance_03be98da6.html

应重定向到:

http://showtime.com.ph

具体单词应为its-showtime。其中its-showtime所在的所有URl都应重定向。

我已经尝试了一些东西,但是没有用。

更新:现有.htaccess文件:

RewriteCond %{HTTP_HOST} ^([^.]+)\.showtime\.com\.ph$ [NC]
RewriteRule ^(.*)$ showtime\.com\.ph/$1 [L,R=301,NC]

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

已解决: https://webmasters.stackexchange.com/questions/88435/how-to-redirect-url-with-specific-characters/88440?noredirect=1#comment108357_88440

1 个答案:

答案 0 :(得分:0)

您可以在.htaccess

中使用它
RewriteEngine on
RewriteRule its-showtime http://showtime.com.ph [NC,R=301,L]
相关问题