Articles of 重写

nginx将URL重写为小写的url

我有nginx设置,但是我需要解决一个问题,有人input“/ Home”来: 把它重写成小写的“/ home”(对所有文件和目录,不只是在家里),而是find大写(如果有的话)文件。 还是需要添加另一个使用不区分大小写的字符“〜*”的位置? 实际的目录和文件布局确实包含混合的大写和小写字符。 为了简单起见,我想保留这个,例如/ Home和/ About是实际的目录,但是对于SEO,我想永久redirect到小写/ home,但是find实际的/ Home目录。 我不确定这是否可以通过重写规则来完成,或者是否在“位置/ {}”或某个组合上不区分大小写。 location / { try_files $uri $uri/ /Home; } 注意:我不是在寻找属于Nginx陷阱的答案, 包括邪恶的Ifs 。

Apache服务器CGI错误500

我试图为GIT的“cgit”web-ui设置一个服务器。 我已经从开发人员的网站下载了源代码,并按照说明正确编译了它。 我的default-server.conf如下所示: # # Global configuration that will be applicable for all virtual hosts, unless # deleted here, or overriden elswhere. # DocumentRoot "/srv/www/htdocs/cgit" # # Configure the DocumentRoot # <Directory "/srv/www/htdocs"> # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews […]

nginx重写caching图像的规则

目前我们正在将所有的服务从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吗? 非常感谢你!

使用mod_rewrite来隐藏tomcat端口

我有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?

RewriteCond和wwwlogging

在我的httpd.ini中,我将所有stream量从“example.co.uk”redirect到“www.example.co.uk”,下面的工作正常: RewriteCond %HTTPS off RewriteCond Host: (?!^www.example.co.uk)(.+) RewriteRule /(.*) http\://www.example.co.uk/$2 [I,RP] 我也有一些微型网站也使用这个网站,说:“www.foobar.co.uk”,在IIS 6的主机头设置。有了上述规则,“www.foobar.co.uk”结束于“ www.example.co.uk“! 有没有一个RewriteCond我可以做的反对请求,以确保请求是“example.co.uk”不捕获微型网站,并重写这些? 或者甚至更好,我可以采取任何方式,无论是“example.co.uk”还是“foobar.co.uk”,只是在它前面的WWW? 谢谢你的帮助。

Nginx:将文件夹重写到folder2

我需要做一个简单的重写,并不能找出如何。 将“ http://example.com/”index.php / administrator / catalog_product / new /“dumpidum”改写为“ http://example.com/”index.php / administrator / catalog_product / new / set / 4 / type /简单/ “dumpidum” 我发现的是: rewrite /index\.php/administrator/catalog_product/new/(.*)$ /index.php/administrator/catalog_product/new/set/4/type/simple/$1; 但是这并不像预期的那样工作。 注意:apache2代码将是: Redirect 302 /index.php/administrator/catalog_product/new/key/ http://example.com/index.php/administrator/catalog_product/new/set/4/type/simple/key/ 有人看到我做错了吗? 我非常想知道

.htaccess将所有查询重写为静态页面

我有一个帐户,有数百个入站链接到他们的日历显示为404(他们把他们的网站移动到一个新的平台)。 我想做一个通配符的查询所有的URL到他们的旧事件日历登陆一个新的静态页面,并为他们的网上商店查询做同样的事情。 我已经尝试了几个变化,但似乎无法得到它的工作。 案例1:我需要redirect这样的url(请注意“showDay”和“showWeek”之间的区别): calid = 5107976&year = 2011&month = 7&day = 10 apps / calendar / showDay?calID = 5107976&year = 2011&month = 9&day = 10 至: http://domain.com/events/ 情况2:还有这样的url: 应用/networking商店/产品/显示/ 1927074 TO: http : //subdomain.domain.com/ 我似乎无法得到所有的URLS和redirect他们的语法正确。 我正在寻找一个像“apps / calendar / *”通配符在命令行中的通配符。 任何帮助表示赞赏!

configurationhttpd.conf来处理带有* multiple *脚本的通配符域

我有一个完整的网站,如: http://www.example.com (uses index.php) http://www.example.com/scriptA.php http://www.example.com/scriptB.php 我现在想要build立子网站的可能性如下: http://alpha.example.com http://alpha.example.com/scriptA.php http://alpha.example.com/scriptB.php 从https://stackoverflow.com/questions/2844004/subdomain-url-rewriting-and-web-apps/2844033#2844033 ,我明白,我必须这样做: RewriteCond %{HTTP_HOST} ^([^./]+)\.example\.com$ RewriteCond %1 !=www RewriteRule ^ index.php?domain=%1 但是其他脚本如scriptA和scriptB呢? 我如何告诉httpd.conf正确处理这些? 我怎么能告诉httpd.conf处理“forwardslash”之后的所有内容 ,就像在主站点上一样,但是传递一个参数标志 &domain=alpha EDIT1 … I have lots of these subdomains being used, but I placed them _before_ the main 'www' one. … <VirtualHost IPADDRESS:80> ServerAlias test4.example.com ServerAdmin [email protected] DocumentRoot /home/test4/public_html ServerName […]

需要nginx regex重写debugging帮助

可能重复: 需要自定义Nginx的正则expression式 期望的结果是这样的: http://www.example.com/about/?r=something 对此: http://www.example.com/about.php/?r=something 这是我得到的,但它不工作: if (!-e $request_filename) { rewrite ^/([^?]*[^?/])/?(\?.*)?$ /$1.php/$2 last; break; } 我在这里做错了什么?

如果在URL的任何部分find子string,则重写

index.php?action=affiliate/registration /affiliate/registration/ 我想重写这个URL到index.php?action=notfound因为在URL的任何部分都有affiliate/registration子string。