我的主目录中有一个htaccess文件,它将所有顶级目录redirect到一个PHP文件。 – > /Loch会去/profile.php?username=Loch 但是我也有一个子目录,让我们称之为test 我需要一个test中的规则,说:“我的目录的任何子path实际上是GETvariables。 例如,链接到/test/hello/hi 实际上应该去/test/receiver.php?dataset=hello&action=hi 但是,当我在/test/目录下的htaccess文件中使用以下规则时,它不会以这种方式工作(我得到一个500错误)。 RewriteBase / RewriteEngine On RewriteRule ^(.*?)/(.*?)/?$ /receiver.php?dataset=$1&action=$2 RewriteRule ^(.*?)/?$ /receiver.php?dataset=$1 我希望我已经提供了足够的信息,请帮助! 谢谢。
无论如何,在S3上为静态托pipe的网站设置URL重写? 我正在迁移一个现有的网站和一些url,我希望他们有一个301redirect,我不想有所有我的网站文件的DOT HTML的过程。 这是可能的,或者我应该只废旧的URL系统,并创build一个更新的网站地图?
我想将nginx中的一部分URI放入一个Variable中。 目前我有这个规则。 if ( !-e /tmp/access_22092012_$cookie_PHPSESSID.tmp ) { rewrite /folder1/folder2/(.*) /folder1/folder1.php?file=$1 last; } 请求就像 HTTP://my.domain/folder1/folder2/22092012/index.html HTTP://my.domain/folder1/folder2/22092012/files/x.sfw 22092012可以有其他号码。 我想从URL 22092012部分提取到一个variables中,然后在上面的文件存在条件中进行: if ( !-e /tmp/access_$urlpart_$cookie_PHPSESSID.tmp ) { rewrite /folder1/folder2/(.*) /folder1/folder1.php?file=$1 last; } 为什么我需要这个:我做一个login保护,以保护会话login文件。 我的应用程序写入的tmp文件,所以如果在一个文件夹中有100个文件,脚本不需要validation每个文件,如果它有权限,并不需要运行每个文件的PHP工人。 这可能吗?
我真的需要帮助。 现在坐了一会儿,不知道该怎么办。 我想要实现一个非常简单的任务 – 重写一个不存在的PHP文件到另一个前所未有的PHP文件,所有参数如: this http://example.com/nonexistent.php?url=google.com to -> http://example.com/existent.php?url=google.com 我尝试了这样的事情: rewrite ^/nonexistent.php /existent.php; 哪个不工作(文件未find)。 但redirect一个不存在的HTML文件到这样的PHP文件: rewrite ^/nonexistent.html /existent.php; 作品。 我不想重写一个html文件,但这仍然是一个令人困惑的行为。 因此,它也尝试了这样的(和一些变化): rewrite ^/nonexistent.php?url=^(.*)$ /existent.php?url=$1; 这也是行不通的。 (也许语法不好) 任何帮助吗? 这将是非常好的!
在我的nginxconfiguration中,我有多个位置块,例如 location ~* /a { ..} location ~* /b { ..} location ~* /c { ..} 我想将expires头部应用于上述所有块,例如 location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ { expires 1y; } 由于在nginx , 位置块是相互独立的 ,所以不是在上面的每个位置重复[1] expires块,有没有更好的方式来写configuration? [1] location ~* /a { location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ … } location ~* /b { location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ … } location ~* /c { location ~* ^/.*\.(?:css|js|jpg|jpeg|gif|png)$ […]
我正在试图为以下情况实现nginx重写规则 请求: http://192.168.64.76/Shep.ElicenseWeb/Public/OutputDocuments.ashx?uinz=12009718&iinbin=860610350635 应该redirect到: http://localhost:82/Public/OutputDocuments.ashx?uinz=12009718&iinbin=860610350635 我试过这个没有运气: location /Shep.ElicenseWeb/ { rewrite ^/Shep.ElicenseWeb/ /$1 last; proxy_pass http://localhost:82; } 什么是正确的方式来执行这样的重写nginx?
尝试了解SSL证书如何工作。 以下是正确的: 我在www.example.com上有一个网站,在mail.example.com上有一个邮件服务器。 该网站是公开的,许多人参观。 邮件服务器只针对我认识的一小群人。 我想添加到networking和邮件服务器的SSL。 据我所知,除非我购买通配符证书,否则证书只对www.example.com或mail.example.com有效,对吗? 我会得到一个可靠的公司的SSL证书,我所有的访问者都会很高兴。 为了节省一些钱,我想为邮件服务器获得一个免费或自签名的证书。 据我所知,在第一次访问邮件服务器时,我们的邮件用户会看到一个未知证书的警告信息。 但是在被邮件用户的电脑接受一次后,这个免费的证书和支付证书是否有区别呢? 有些相关的问题。 我目前在apache conf中将example.com设置为www.example.com的别名。 因此,如果有人访问example.com(不带“www”),那么URL将保持在那里,我的www.example.com证书将无效,正确吗? 所以我必须添加重写规则来将example.com更改为www.example.com,对吗?
所以我在我的服务器上安装了nginx和Wordpress。 但是,我的博客不在域根。 (例如example.com/blog ,内容位于/var/www/example.com/blog ) 我在nginx中使用下面的设置,我的Wordpress安装使用Apache中的URL重写规则。 (例如像example.com/blog/2012/hello-world永久链接) 但是,有趣的是,所有这些URL重写规则都进入了/ (而不是在blog/ )中的index.php 。 我想解决,但我不知道如何。 另一个有趣的事情是, example.com/blog (主页)工作正常。 例如,因为example.com/blog/2012/hello-world不是真正的文件,所以try_files正在执行example.com/index.php 。 (url保持不变,但index.php得到执行)。 任何帮助表示赞赏! server { listen 80; root /var/www/example.com; index index.php; server_name 192.34.59.214; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # pass […]
问题:我无法让我的网站从httpsredirect到http。 好的,这里提供了一些解决scheme,但没有一个似乎为我工作。 为了build立一些东西,我已经有了.htaccess在这个网站上工作得很好,所以需要设置AllowOverride的方式。 我所看到的最基本的东西是添加如下内容: RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} …到我的.htaccess文件。 然而,这并没有什么好处,就好像病情没有得到满足。 设置后,访问https://mysite.com我没有redirect到http://mysite.com,因为我期望,而只是通过https://mysite.com 。 这是什么原因? 我的期望是,以上在我的.htaccess文件和.htaccess文件在我的网站上正常工作,当我访问任何httpsurl时,我将被redirect到它的http等效。 更多信息 在临时服务器上在我的登台服务器上添加上面的htaccess发送给我一个URL的参数附加到它像http://mystaging-site.com/?ysid=2pnd073423ra966tihf22rfr9a2 在Prod服务器上生产的快速testing结果在一个Apache错误页面,说该页面已被移动,并有500服务器错误。 错误消息的具体内容是: Found The document has moved here. <— this link simply points to the same page I am already on Additionally, a 500 Internal Server Error error was encountered while trying to use an […]
我想要apache: 将http用户redirect到https 如果他们访问http(s)://example.com/1234redirect到/ view / 1234 我尝试了不同的口味,但不能得到它的工作。 当用户访问网站时,他们被redirect到https://,但是我无法获得/ {numeric}redirect到添加/查看/。 数字规则工作正常,直到我把httpsredirect。 我已经尝试了RewriteCond%{HTTPS} = on,但是这会导致500个错误。 RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://domain.example.org/$1 [R,L] RewriteRule ^(\d+)$ https://domain.example.org/view/$1 [R=301,L]