简体   繁体   English

重定向除userdir外的所有内容(mod_rewrite)

[英]redirect all except userdir (mod_rewrite)

I have a pretty simple problem: redirect all url from a domain except when this url is pointing to a 'userdir': 我有一个非常简单的问题:从域重定向所有URL,除非此URL指向“ userdir”:

Example: 例:

http://exemple.com --> http://www.exemple.com http://exemple.com > http://www.exemple.com

http://exemple.com/blabla --> http://www.exemple.com/blabla http://exemple.com/blabla > http://www.exemple.com/blabla

http://exemple.com/~blabla --> no redirection http://exemple.com/~blabla >没有重定向

So far I have this but it does half the work: 到目前为止,我已经做到了,但是它完成了一半的工作:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}$1 [R=301,L]

Thank in advance 预先感谢

Solved... 解决了...

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/~([^/]+)
RewriteRule ^(.*)$ https://www.%{HTTP_HOST} [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM