我正在尝试在.htaccess中设置一些url重写。
第一种是用语言代码重定向urls (网站现在只有一种语言):
RewriteRule ^en/(.*)$ /$1 [R=301,L]
RewriteRule ^es/(.*)$ /$1 [R=301,L]========================
第二个是为了seo目的而更具描述性:
/社区/
至
/教师和学生/
RewriteCond %{REQUEST_URI} ^.*/community.*$
RewriteRule .* /tutors-and-students [L,R=301,DPI]=================================
第三个更改配置文件urls:
/community/myprofile/username
至
/tutors-and-students/用户名
RedirectMatch permanent myprofile(.*) http://www.profr.org/tutors-and-students/$1=========================
它们都是独立工作的,但不是协同工作的:
RewriteRule ^en/(.*)$ /$1 [R=301,L]
RewriteRule ^es/(.*)$ /$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^.*/community.*$
RewriteRule .* /tutors-and-students [L,R=301,DPI]
RedirectMatch permanent myprofile(.*) http://www.profr.org/tutors-and-students/$1感谢你的提示。
发布于 2013-10-03 02:44:51
你应该坚持使用mod_rewrite,而不是将它与来自mod_alias的重定向混合在一起:
RewriteRule ^en/(.*)$ /$1 [R=301,L]
RewriteRule ^es/(.*)$ /$1 [R=301,L]
RewriteRule ^.*/?community /tutors-and-students [L,R=301,DPI]
RewriteRule ^.*/?myprofile(.*)$ /tutors-and-students/$1 [L,R=301]https://stackoverflow.com/questions/19144120
复制相似问题