Articles of 重写

.htaccess错误与CSS

嘿,伙计们,我真的需要你写seourl的帮助。 我是新来的阿帕奇,国防部重写和.htaccess和一个星期后没有成功。 我想改变: sub.domain.com/soccer/teams.php?name=tiger到sub.domain.com/soccer/tigers 我的链接(老虎)应该是什么? 我怎么会这样设置,它不会导致.css | .jpg | .png错误。 我的.htaccess文件位于/ soccer /文件夹中。 请帮助或指导我到哪里我可以很好的帮助。

黑名单文件/ URL与Nginx重写规则

我正在使用像这样的nginx.congf重写 location / { if (!-e $request_filename) { rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last; } if ($uri ~* "\.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$") { expires max; break; } } 我需要从重写规则中排除“site.com/api.php”。 有人可以指出如何做到这一点?

(Apache)RedirectMatch正则expression式匹配除列表中的所有目录

我需要301redirect请求到http://server.com所有请求被redirect到http://newserver.com除非请求是针对我们在传统服务器上维护的任意目录列表(例如服务器.com / foo或server.com/bar) 我正在努力研究如何设置这个和正则expression式。 EG,我需要: http://server.com/page1redirect到http://newserver.com/page1 http://server.com/dir1/page2redirect到http://newserver.com/dir1/page2 http://server.com/foo加载正常 http://server.com/bar/baz.html加载正常 …因为'foo'和'bar'在我的传统dirs列表中。 我想知道是否要做到这一点是如何捕捉我的列表中的匹配,然后redirect其他任何通配符到新的服务器 – 但我不能让它的工作。 任何人都可以帮助我一些正则expression式,并为那些请重写? 谢谢

Apache上的文件夹中的子域

我在本地主机上有一个网站,映射在HOSTS中: 127.0.0.1 www.yorkshiretestingwebsite.com 127.0.0.1 yorkshiretestingwebsite.com 但是,该文件夹(C:/www/vhosts/yorkshiretestingwebsite.com)中有一些子文件夹,即: 利兹 船壳 谢菲尔德 而不是input http://www.yorkshiretestingwebsite.com/leeds 我想尝试并将url设为: http://leeds.yorkshiretestingwebsite.com 我已经看过如何在Google上这样做,但我不太清楚如何做到这一点。 我试过这里的build议 – https://serverfault.com/questions/235311/automatic-subdomain-creation-in-htaccess-on-apache – 它确实工作(好,如果我只有几个文件夹),但如果我有多个? 我不想继续添加它,所以我一直在试图find一个解决scheme。 什么是达到这个目的的最好方法?

相当于Apache Files指令的Lighttpd?

我试图从Apache转换一些规则和设置为lighttpd,但我坚持这个文件的规则: <Directory /var/www/html/attachments> <Files ~ "\.(php\d*|cgi|pl|phtml)$"> order allow,deny deny from all </Files> </Directory> 看看这个文档,我可以看到我可以使用url.access-deny。 $ HTTP [“url”] =〜“^ / var / www / html / attachments”{ url.access-deny =(“”) } 但不知道如何转换文件的一部分,任何想法? 谢谢!

Apache重写规则并保持url不变?

我有这个重写规则 RewriteRule ^ ar $ /index2.html 但我需要保持redirect后,地址栏中的url不变。 即。 如果用户inputhttp://mydomain.com/ar我需要redirect他到/index2.html,但保持原样的url。 任何想法如何做到这一点? 谢谢你的帮助

nginx将子域redirect到一个文件夹

在Nginx中,我想将我的subdomain.domain.comredirect到domain.com/sub/。我该怎么做? 我想为domain.com使用现有的站点configuration文件,而不是创build一个新的。 我有的configuration文件是(如何添加到此) ====== server { listen 80; server_name www.domain.com domain.com *.domain.com; access_log /srv/www/domain.com/logs/access.log; error_log /srv/www/domain.com/logs/error.log; location / { root /srv/www/domain.com/public_html; index index.html index.htm; } location / phpmyadmin {root / usr / share; index index.php; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /srv/www/domain.com/public_html$fastcgi_script_name; } } =========

用nginx重写url,使其成为index.html

我使用S3来托pipe一些静态内容,并使用一些URL重写,使一切工作。 这是我现在的configuration: server { listen 80; ## listen for ipv4 listen [::]:80 default ipv6only=on; ## listen for ipv6 server_name "~^(.+)\.bar\.com$"; access_log /var/log/nginx/foobar-star.access.log; set $subdomain $1; rewrite ^(.*)$ /$subdomain$request_uri?; location / { proxy_pass http://foo.bar.com.s3.amazonaws.com; } } 我的问题是,如果请求是baz.bar.com我想我的url是foo.bar.com.s3.amazonaws.com/baz/index.html,如果是baz.bar.com/css/whatever .css我想要一般情况下foo.bar.com.s3.amazonaws.com/baz/css/whatever.css,我已经在configuration中覆盖。 我不能使用$ request_filename,因为S3总是提供一些东西,甚至告诉你,你所请求的键不存在,所以我需要一个通用的规则来附加到我的url index.html,以防它不存在。 我相信这是正常的索引指令不工作的原因… 为了简短:如果我试图达到baz.bar.com/index.html所有的东西都像魅力,如果我尝试baz.bar.com/它(正确)返回一个文件,告诉我,关键'baz'不存在。 我想baz.bar.com/直接呈现我的index.html,并保持一切不变。 希望我已经清楚 – 我知道这有点混乱:) TIA

nginx clean forward重写了多个相似的域名

我有大约50个相同的域名与不同的tld类似:domain.net,domain.org,domain.de,domain.biz,domain.ca …现在我想转发所有传入的请求到这个域有和没有www在Nginx的: http : //domain.com我怎么能做到这一点,而不需要列出每个域? 像这样:将所有请求转发到.domain。 或域。*到: http : //domain.com永久

帮助与IIS重写规则

我需要创build一个重写规则如下: OldPage.aspx?UserId = 12345应redirect到NewPage.aspx?Id = 12345 '12345'可以是任何数字值。) 我有页面redirect工作,但不知道如何将“UserId”更改为“Id”(我可以在我的代码中执行,而是在web.config中执行)。 这是我的: <rewrite> <rules> <rule name="Old Site to New" patternSyntax="Wildcard" stopProcessing="true"> <match url="*OldPage.aspx*" /> <action type="Rewrite" url="NewPage.aspx" appendQueryString="true" logRewrittenUrl="true" /> </rule> </rules> </rewrite> 我使用的是通配符,但是对于正则expression式或通配符的build议都可以。