我想将一些网址重定向到不同的网址。例如
http://www.mydomain.com/some-text-2-rss/
http://www.mydomain.com/another-text-rss
http://www.mydomain.com/sample-rss/
http://www.mydomain.com/dummy-content-rss
http://www.mydomain.com/some-folder-1/my-text-rss
http://www.mydomain.com/another-folder/some-text-rss/
TO
http://www.mydomain.com/some-text-2/
http://www.mydomain.com/another-text
http://www.mydomain.com/sample/
http://www.mydomain.com/dummy-content
http://www.mydomain.com/some-folder-1/my-text
http://www.mydomain.com/another-folder/some-text/
即如果任何网址的结尾是'-rss'或'-rss /',我想从网址中删除'-rss'。
先谢谢。
答案 0 :(得分:0)
通过httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放在.htaccess
目录下的DOCUMENT_ROOT
中:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(.+?)-rss(/?)$ /$1$2 [L,NC,R]