我试图在我的.htaccess文件中写入我的mod_rewrite规则,以修复当访问者访问我的网站时在浏览器栏中显示的URL。 我有几个选项,我希望我的用户能够进入。 他们应该能够input如下内容: aaa.xxx.yyy.edu bbb.xxx.yyy.edu 它应该前进 bbb.org 其中bbb.org是我自己指向网站的url。 我已经有了一个移除www的规则。 从任何一个的前面,我有一个规则,将转发aaa.xxx.yyy.edu bbb.xxx.yyy.edu,但如果你去bbb.org,浏览器栏中的URL显示为bbb.xxx.yyy.edu。 有什么build议么?
目前我们正在将所有的服务从apache2迁移到nginx,但是目前还停留在特定的重写规则中。 apache中的规则是检查caching的图像/缩略图是否存在,如果存在,则直接发送输出。 否则会将请求重写到image processing器。 # if cached version exists, output directly RewriteCond %{QUERY_STRING} ^(Guest|Member|avatar|tagged|thumb)$ RewriteCond %{DOCUMENT_ROOT}/cache/$1/%{QUERY_STRING}.jpg -f RewriteRule (.*)\.jpg$ /cache/$1/%{QUERY_STRING}.jpg [L] # otherwise redirect all jpg-image-requests to processing # script if they are not in cache dir RewriteCond %{REQUEST_URI} !^/cache RewriteRule \.jpg$ /image_processing.php [QSA,L] 我们尝试了几个try_files方法,但是到目前为止我们失败了。 有人可以帮助将这个重写规则移植到Nginx吗? 非常感谢你!
RewriteRule ^index.php/(.*)$ redirect.php?s=$1 与…合作 website.com/index.php/something 但不是 website.com/something 任何方式来得到这个工作? RewriteRule ^/(.*)$ redirect.php?s=$1没有办法。
我试图使用mod_rewrite将用户redirect到HTTPS等价的URL,除非URL是用于我的Jenkins CI服务器。 这是我在我的默认站点configuration(我的jenkins和其他网站有自己的VirtualHost条目: <VirtualHost _default_:80> ServerAdmin [email protected] RewriteEngine on ReWriteCond %{SERVER_PORT} !^443$ ReWriteCond %{REQUEST_URI} !^.+/jenkins/(.*)$ RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L] </VirtualHost> 任何帮助将不胜感激。 编辑:按要求,这里是apache2ctl -S的输出: VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:443 is a NameVirtualHost default server ip-10-72-226-167.ec2.internal (/etc/apache2/sites-enabled/default-ssl:2) port 443 namevhost ip-10-72-226-167.ec2.internal (/etc/apache2/sites-enabled/default-ssl:2) port 443 namevhost qa.example.com (/etc/apache2/sites-enabled/example-ssl:2) *:80 is a NameVirtualHost default server ip-10-72-226-167.ec2.internal […]
要解决安全问题,我需要添加一些重写规则到我们所有的虚拟主机configuration。 除了更新每个虚拟主机声明之外,是否有任何选项将重写规则添加到每个虚拟主机声明? 更新: 参考文档指出: 请注意,重写configuration不会被虚拟主机inheritance。 这意味着您需要为每个您希望使用重写规则的虚拟主机启用RewriteEngine on指令。 我不确定这是否意味着虚拟主机不考虑一般的重写规则。
我正在使用Apache的mod_rewrite将移动用户根据他们的http_user_agentredirect到我的移动站点。 然而并不是所有的页面都有一个移动等值 移动网页也以.html结尾,“完整”网页以.shtml结尾。 这里是一些伪代码。 用户是否具有特定的HTTP_USER_AGENT? 有移动网页吗? 如果是的话,带他们去那里 如果不是,则不需要redirect。
我有一个Ubuntu的Apache的服务器,与许多网站。 我所有的网站都有相同的错误(所以它看起来像一个错误的configuration) http://www.2sigma.fr < – 它工作正常(我们看到“en travaux”) http://2sigma.fr < – 不工作,我得到310错误(循环redirect!) 在这里我的.htaccess Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^2sigma\.fr$ RewriteRule ^(.*) http://www.2sigma.fr/$1 [R=301,L] 在这里我的configuration <VirtualHost *:80> <IfModule mpm_itk_module> AssignUserId sigma www-data </IfModule> ServerAdmin [email protected] ServerName 2sigma.fr ServerAlias www.2sigma.fr DocumentRoot /home/sigma/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /home/sigma/www> Options Indexes FollowSymLinks MultiViews AllowOverride All […]
我有Tomcat上的应用程序使用这样的URL: http://xxx:8080/myapp 我不希望用户在URL中看到端口。 嗨可以做一个这样的重写规则: RewriteRule ^/myapp(.*) http://xxx:8080/myapp$1 [P,L] 这样,如果用户转到URL http://xxx/myapp他可以进入应用程序,但端口仍然会显示在浏览器上。 我希望用户看到的URL总是http://xxx/myapp 我怎样才能做到这一点使用mod_rewrite?
我的服务器操作系统是debian挤压。 我有这些行来redirect非www到我的网站的htaccess文件中的www: RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 但在Firefox中导致这个错误: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies. 当我评论这些行在htaccess mysite出现,但在非www格式。 我确定它在Ubuntu上运行良好。 但我不知道为什么现在不行。 你能帮我吗?
我是新的使用正则expression式重写URL的htaccess中 我需要将mysite.com/123redirect到mysite.com/,如果cookie设置为'ref'。 我目前的htaccess是: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_COOKIE} ref=true [NC] RewriteRule ^/([0-9]+)/$ http://www.mysite.com </IfModule> 目标是,当有人进入网站:mysite.com/111(一些数字),他们被redirect到该网站的主页后,cookie被设置。