好的,所以我在我的服务器上设置了URL重写(IIS 7),例如, http://example.org/p/1234/ 是真的 http://example.org/product/?product_id=1234 (使用/ product /包含能够处理查询参数的Web应用程序的索引文件)。 问题是,我想现在每个人都使用/p/1234/ url,所以我想每当有人访问/product/?product_id=1234的旧 url时发送301redirect, 但据我所知当发生URL重写时,就服务器而言,用户确实去了/product/?product_id=1234 。 虽然在浏览器的URL栏中可能会说http://example.org/p/1234/ ,当我做一个标题和CGIvariables的转储时, /p/1234/不会显示在任何variables中。 我想我的担心是,即使我能做到这一点,似乎也会让一个简单的请求变得相当复杂: 转到/p/1234/ 将其重写为/product/?product_id=1234 原来是/p/1234/ ? ( 是 ) 没做什么。 否则: 转到/product/?product_id=1234 原来是/p/1234/ ? ( 不 ) 301redirect到/p/1234/ 将其重写为/product/?product_id=1234 原来是/p/1234/ ? ( 是 ) 没做什么。 我知道,最终一些search索引将消除旧的URL赞成301redirect指定的那些,但在那之前,似乎有很多的服务器开销。 另外,如果我确实设置了,是否有一个filter,我可以在IIS中使用这样做,或者我需要将逻辑添加到我的webapp? 请注意,我为所有这些网页设置了<link rel="canonical"…/> ,但是我仍然看到旧格式显示在search结果中。
我有这样的url: http://www.domain.com/index.php?route=product/product&path=someString&product_id=1111111 我需要将来自index.php的请求redirect到: http://www.domain.com/p/1111111/ 我知道apache的方法通过.htaccess,但我怎么在IIS7上做到这一点?
我有以下的configuration文件,除了PHP页面的一切工作。 我试图让所有的东西作为一个古老的浏览器添加/ IE /在URL中。 本质上改变这些客户端的根,尽pipe你不能在一个if中设置它。 如果我在PHP位置添加重写也不起作用。 有任何想法吗? location / { if ($ancient_browser) { rewrite ^(.*)$ /IE/$1 break; } try_files $uri $uri/ /index.php; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_index index.php; if (-f $request_filename) { fastcgi_pass 127.0.0.1:9000; } }
我在configurationNginx代替Apache时遇到了一些问题,所以它为客户端提供了Mumble Django服务。 我有vhosts configuration为Apache和Lighttpd – 让我把他们放在这里并排,为您节省点击:)。 Apache2利用WSGI作为CGI运行Django Python。 就我所见,Lighttpd就像Nginx / PHP-FPM一样工作。 专用的Apache2虚拟主机 – configuration: <VirtualHost *:80> ServerName example.com ServerAlias www.example.com Alias /static/admin/ /usr/share/pyshared/django/contrib/admin/static/admin/ Alias /static/ /srv/mumble-django/htdocs/ Alias /mumble/media/ /srv/mumble-django/pyweb/mumble/media/ WSGIScriptAlias / /srv/mumble-django/mumble-django.wsgi WSGIDaemonProcess mumble-django threads=25 WSGIProcessGroup mumble-django WSGIScriptReloading Off # Cache optimization – not necessarily needed for MD, but nice to have 🙂 FileETag None […]
尽pipe我已经花了两天的时间在论坛上阅读,但我仍然无法在Nginx中重写一些Codeigniter重写。 这是服务器configuration: server { listen *:80; server_name artademy.com www.artademy.com; root /var/www/artademy.com/web; index index.html index.htm index.php index.cgi index.pl index.xhtml; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1; } if (!-e $request_filename) { rewrite ^/(index.php\?)/(.*)$ /$1/mobile_app last; break; } error_log /var/log/ispconfig/httpd/artademy.com/error.log; access_log /var/log/ispconfig/httpd/artademy.com/access.log combined; ## Disable .htaccess and other hidden files location ~ /\. { deny all; access_log […]
我正在AWS上部署应用程序和Wordpress安装。 我有一个EC2下的Apache下build立的WordPress,我的应用程序在Lighttpd下,我想通过应用程序节点反向代理WordPress。 这工作正常,我只是在Lighttpd中设置反向代理,如下所示: $HTTP["url"] =~ "^/blog" { proxy.server = ( "/blog" => ( "blog" => ( "host" => "123.456.789.123", "port" => 80 )) ) } url.rewrite-once = ( "^(.*?)$" => "/index.php/$1" ) 但是,这个问题是在重写。 当我启用重写时,它会在反向代理之前捕获它,并在应用程序服务器index.php由到index.php 。 我需要它不会重写,如果它要去博客。 我尝试了各种正则expression式匹配和其他configuration,但是我一直没有能够支持重写和代理。 如何才能做到这一点?
有没有通用的规则来重写版本? /css/main.123456.css重写为/css/main.css /css/styles.123456.css重写为/css/styles.css /js/application.123456.js重写为/js/application.js 我应该如何修改我的.htaccess文件来为css / js文件添加通用版本? # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
我希望我的服务器代理Google如果我的$request_body的POSTed请求包含stringgoogle ,例如 echo "google" | lwp-request -m POST "http://127.0.0.1" 所以我有这样的configuration,例如 server { listen 127.0.0.1:80 default; location / { if ($request_body ~* .*google.*) { proxy_pass http://www.google.com; break; } } } 但是上面configuration的结果总是“404 Not Found” 任何想法? 谢谢。
我不知道为什么这不起作用。 我试过创build地图规则,然后重写和redirect的url。 我试着用一个简单的重写规则redirect它,不pipe怎样,唯一能让它工作的是如果我设置匹配url来匹配这个正则expression式。 我正在尝试将webmail.example.comredirect到mail.example.com。 看起来好像只需要几秒钟; 男孩是我错了。 我想我一定是做了错误的正则expression式,但我不知道什么时候我testing它似乎工作正常。 <rule name="webmail" patternSyntax="ECMAScript" stopProcessing="true"> <match url=".*webmail.*" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> </conditions> <action type="Redirect" url="https://mail.example.com:8000" appendQueryString="false" logRewrittenUrl="true" /> </rule> 谢谢
目前,我正在与ViewVC的lighttpd的configuration挣扎。 configuration从Apache 2.2.x移植,它仍然在机器上运行,服务于WebDAV / SVN的东西,通过代理。 现在,我遇到的问题似乎与重写规则,我不知道我在这里错过了什么。 这里是我的configuration(略作简要说明): var.hgwebfcgi = "/var/www/vcs/bin/hgweb.fcgi" var.viewvcfcgi = "/var/www/vcs/bin/wsgi/viewvc.fcgi" var.viewvcstatic = "/var/www/vcs/templates/docroot" var.vcs_errorlog = "/var/log/lighttpd/error.log" var.vcs_accesslog = "/var/log/lighttpd/access.log" $HTTP["host"] =~ "domain.tld" { $SERVER["socket"] == ":443" { protocol = "https://" ssl.engine = "enable" ssl.pemfile = "/etc/lighttpd/ssl/…" ssl.ca-file = "/etc/lighttpd/ssl/…" ssl.use-sslv2 = "disable" setenv.add-environment = ( "HTTPS" => "on" ) url.rewrite-once += ("^/mercurial$" […]