我们与偶尔复制到本地环境进行例行debugging的网站合作 这些网站有很多用户生成的媒体 – 特别是图像。 为避免下载所有这些文件,我们有一个简单的redirect规则,因此某个文件夹中的任何返回404的文件/文件夹都会被redirect到生产服务器。 问题 该规则只能在网站在本地主机上运行时应用。 例如条件:请求是本地主机。 <!– Handle missing files or folders inside the /Media directory on Development Environment –> <rule name="Handle missing media" stopProcessing="true"> <match url="^media/(.*)" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <!– Add Conditions, so local only –> </conditions> <action type="Redirect" redirectType="Temporary" url="http://production.domain/{R:0}" appendQueryString="true" […]
我们有一个网站在abc.company.com下abc.company.com 。 我们已经被要求让一个客户在不同的域名下提供不同的url,比如说stuff.abc.com 。 他们已经安排了所有的stream量到stuff.abc.com (他们的服务器)被redirect到通往服务器托pipeabc.company.com (我们的服务器)的IP地址。 networking服务器有两个IP地址可用(为了能够有两个SSL证书,我已经设置了绑定,如下所示: https [no hostname] 443 10.20.1.50 (with matching SSL certificate) http abc.company.com 80 * 以上的作品罚款的旧1 url的情况。 我添加了这些绑定: https [no hostname] 443 10.20.1.70 (with a new matching SSL certificate) http stuff.abc.com 80 * 我的问题是这是否是正确的,或者我需要设置URL重写。 我也想知道是否应该为新的域绑定明确添加.70 IP,或者“全部未分配”是否正常。 如果我需要URL重写任何示例将不胜感激。
我怎样才能强制SSL没有WWW # SSL-FORCE RewriteCond %{SERVER_PORT} !443 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] 工程,但我也可以打开www的网站。 提前致谢。
我有一个网站,其名称从example.com更改为newexample.com。 我的思考过程(请评论这一点,以及我的方法可能是不正确的)是configuration永久redirect从http:(s):// .example.com / (我不使用字面正则expression意义这里) https://www.newexample.com/ 。 在重写规则部分,我采取了以下的方法: <rewrite> <rules> <rule name="Redirect to newexample.com"> <match url=".*" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern=".*" negate="true" /> </conditions> <action type="Redirect" url="https://www.newexample.com/{R:0}" redirectType="Permanent"/> </rule> </rules> </rewrite> 我了解上述规则的方式是,任何主机名将被redirect到“ https://www.newexample.com/whatever ”,离开所请求的url的所有其他方面,但我没有得到redirect使用任何我到目前为止尝试的组合。
我试图安装我的第一个LEMP堆栈,经过了很多小时的阅读,它工作得很好(该死的,www-data组的写权限问题是一个艰难的问题)。 无论如何,我的Joomla网站现在工作和performance比以往更好,但我注意到一个奇怪的问题,漂亮的url: 如果我访问www.mysite.com/index.php/some/content/alias/一切都很好。 但是,如果我访问www.mysite.com/index.phpsome/content/alias/ (注意index.php之后缺less斜线)也是可以的。 这是预期的行为? 我知道最终用户不会访问那些,但它的存在正在驱使我疯狂,因为它应该扔404,对吧? 这是我的configuration: server { listen 80; server_name domain.bla; return 301 http://www.domain.bla$request_uri; } server { listen 80; server_name www.domain.bla; root /home/domain/public_html; index index.php index.html index.html; #Specify a charset charset utf-8; # Custom 404 page error_page 404 /404.html; # Include the basic h5bp config set # The error remains if I […]
我有这样的configuration: location ~ ^/myway(.*) { rewrite ^/myway(.*)$ /anotherway$1; rewrite_log on; error_log /var/log/nginx/errors notice; } location /anotherway { … internal; } url: site.com/myway/可以正常工作(重写为site.com/anotherway/ )。 但url: site.com/mywayredirect到site.com/anotherway/ 。 为什么? 应该给404错误?
我正在尝试redirect一个特定的URL,如: http://www.domain.com/cadena-de-metas 我正在通过我的configuration文件在/ sites-available / if ( $request_filename ~ cadena-de-metas/ ) { rewrite ^ https://some-other-url.com? permanent; } 这工作,但不幸的是它redirect以及这个url: http://www.domain.com/uploads/descarga-cadena-de-metas.jpg 我怎样才能防止这个?
我正在尝试重写数百个url,除了一个场景外,我已经非常接近了。 有些url是这样的: /city/?sl_city=CityName&directory_nonce=45ad967e02 但是有些在sl_city查询sl_city有一个+作为单词分隔符。 那些需要改变为- /city/?sl_city=Some+City&directory_nonce=45ad967e02 这两个url的最终结果应如下所示: /locations/cityname /locations/some-city 我的基本重写规则是这样的: location ~* ^/city/(.+)? { if ($args ~* "sl_city=(.+)&directory_nonce=(.+)") { set $city $1; set $args ''; rewrite ^.*$ /locations/$city permanent; } } 但我的第二个URL 404s(回来/locations/Some+City ),但locations/Some-City解决。 目前我并不担心这些URL。 基本上我想检查$city之前,它做了最后的永久重写,任何+find,将其更改为- 。 我所看到的所有例子都涉及安装另一个模块,我认为我不能这样做。 而我迄今为止的尝试没有奏效。 编辑 这是我安装的模块。 试图找出是否ngx_http_substitutions_filter_module做我所需要的,但不知道。 nginx version: nginx/1.8.0 built with OpenSSL 1.0.1f 6 Jan 2014 TLS SNI support […]
我安装了Cockpit CMS,并且使用这个conf文件,我想要共享或访问的文件或子网站的每个实际文件夹都被解释为404页,我猜是因为这个部分: location / { try_files $uri /index.php$uri?$args; } 然后我需要指定每个链接和文件夹来启用访问。 这是有点约束。 你有避免这个问题的想法吗? server { listen 443 ssl; … server_name site.com; root /var/sites/_site.com/www; index index.php index.html; location / { try_files $uri /index.php$uri?$args; } location /cockpit { try_files $uri $uri/ /cockpit/index.php; } # Enable PHP with path_info location ~ ^(.+\.php)($|/) { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_split_path_info ^(.+?\.php)(/.*)$; […]
所以基本上我必须代理通过Web服务器的根@ / 但应用程序托pipe在 /ui 当他们没有手动input/ ui时,他们就会出现在服务器的主页上,这是静态的,没有被使用。 我想最初让Nginx把你移到domain.com/ui当你键入domain.com,然后基本上做它通常做的事,代理应用程序。