我想重写我的网站URL以下两种模式(注:有很多这样的url,我希望使用一个规则来重写它们都) www.hetaoblog.com/hello www.hetaoblog.com/hello/ 至 **www.hetaoblog.com/myblogs/post/hello.jhtml** 所有其他案例,如http://www.hetaoblog.com/不应该改变; 我试过了 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule . /index.php [L] RewriteRule ^([^/]+)/$ /myblogs/post/$1.jhtml [L] RewriteRule ^(.*)$ /myblogs/post/$1.jhtml [L] </IfModule> 和 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule . /index.php [L] RewriteRule ^(.+)/$ /myblogs/post/$1.jhtml [L] RewriteRule ^(.*)$ […]
这是我的NGINXconfiguration(没有apache,只是php-fpm): user nginx; worker_processes 1; error_log /usr/local/nginx/logs/error.log notice; pid /var/run/nginx.pid; events { worker_connections 384; } http { include mime.types; default_type application/octet-stream; access_log off; server_tokens off; sendfile on; tcp_nopush on; tcp_nodelay off; client_max_body_size 8M; client_body_timeout 30; client_header_timeout 15; keepalive_timeout 15 65; send_timeout 30; gzip on; gzip_static on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 9; gzip_buffers […]
我正在尝试做一些非常简单的事情。 我只需要强制SSL,我正在尝试使用URl Rewrite插件。 当我将下面的规则放入我的conf时,我没有得到任何结果。 <rewrite> <rules> <rule name="Redirect to https" stopProcessing="true"> <match url="(.*)[^/])$" /> <conditions> <add input="{SERVER_PORT}" pattern="443" negate="true" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" /> </rule> </rules> </rewrite> 任何想法,为什么这不捕捉?
我有包含 – 字符的域名。 例如my-domain.com。 当我使用重写时,Nginx错误地重写URL,浏览器被redirect到my.com而不是my-domain.com。 我的重写规则有什么问题? server { listen 80; server_name www.my-domain.com; rewrite ^/(.*) https://www.my-domain.com permanent; }
我一直在试图让Nginx运行lithium没有成功。 lithium的目录结构就是这样 lithium |-> app libraries .htaccess |-> webroot .htacess –other directories |-> index.php .htaccess –other files 我将lithium文件夹复制到我的/var/www/ 。 锂的path是/var/www/lithium/ 现在我在我的nginx.conf这种方式设置重写规则 server { listen 80; server_name localhost; root /var/www/; location /lithium { rewrite ^/$ /app/webroot/ break; rewrite ^(.*)$ /app/webroot/$1 break; } location /lithium/app { rewrite ^/$ /webroot/ break; rewrite ^(.*)$ /webroot/$1 break; } location /lithium/app/webroot […]
我是全新的URL重写。 我正在IIS 7.5上使用Apache重写模块(我认为)。 无论哪种方式,我都能够成功地重写,但在一些关键的事情上却遇到了麻烦。 我想这个漂亮的url重写到这个丑陋的url: mydomain.com/bike/1234 (pretty) mydomain.com/index.cfm?Section=Bike&BikeID=1234 (ugly) 这个规则很好用: RewriteRule ^bike/([0-9]+)$ /index.cfm?Section=Bike&BikeID$1 问题#1 我希望能够添加一个描述并将其放到完全相同的位置,以便我的应用程序完全忽略有用的信息。 mydomain.com/bike/1234/a-really-great-bike (pretty and useful) mydomain.com/index.cfm?Section=Bike&BikeID=1234 问题#2 我需要能够添加第二个或第三个参数和价值的url,以获得额外的信息数据库,如下所示: mydomain.com/bike/1234/5678 mydomain.com/index.cfm?Section=Bike&BikeID=1234&FeatureID=5678 这使用这个规则: RewriteRule ^bike/([0-9]+)/([0-9]+)$ /index.cfm?Section=Bike&BikeID=$1&FeatureID=$2 再次,我需要添加一些额外的信息,如第一个例子: mydomain.com/bike/1234/5678/a-really-great-bike (pretty and useful) mydomain.com/index.cfm?Section=Bike&BikeID=1234&FeatureID=5678 那么,怎样才能把这些规则结合起来,让我可以有一两个或三个参数,而任何“有用的词”都被完全忽略了?
我可以使用重写和nginx的一点帮助…基本上我的应用程序的结构看起来像这样 Headdirectory — -APPBase -SomeMoreStuff -WWWDirectory .htaccess 所以当我打开HeadDirectory时,我需要redirect到WWWDirectory。 在Apache中,它使用htaccess和以下内容完成: RewriteEngine On RewriteRule ^(.*) www/$1 我已经在Nginx上试过了: location /Headdirectory { rewrite ^/(.*) /www/$1; } 而我试图创build一个别名,但没有工作… 如果有人能帮助我,那会很好。 祝你今天愉快
WordPress的重写规则是这样的: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] 现在我想添加一个新的规则,将提供的URL /testing相同的内容作为根页面,但没有做一个实际的redirect。 我努力了: RewriteRule ^test/$ /index.php [PT] 但似乎给testing作为index.php的参数,因为我得到一个页面未find错误。
我有一个问题,我确定这不是很难,但我真的不知道如何使用Windows IIS控制台。 我有两个静态html页面(Lorem Ippsum页面),当我访问我的网站(如www.mysite.com/lorem1和www.mysite.com/lorem2 )时,我想访问它们。 由于在网站上进行了大量的部署,我不想把网页放在wwwroot因为它们会在下一个版本中被删除。 我也不想集成页面,所以他们来构build,因为它只是为了testing,所以我创build了一个虚拟目录virtdir的HTML页面现在位于,并访问我必须写www.mysite.com/virtdir/lorem1 。 我感兴趣的是:如何将请求www.mysite.com/lorem1redirect到www.mysite.com/virtdir/lorem1 ,以保持我创build的虚拟目录,并使其在浏览器中不可见。
我是新来的Apache安装程序,我遇到了一个问题。 他们其中的几个,但这是唯一的一个:) 我已经为它设置了一个子域sub_example_com和两个虚拟主机:一个用于端口80,第二个用于433.我已经安装了ssl wildecard(像这样: http ://phaseshiftllc.com/articles/2008/10/27/multiple-secure -subdomains-with-a-wildcard-ssl-certificate.html )在子域上使用ssl。 它的工作原理,唯一的问题是,我有一个像/ var / www / sub_example_com / 然后我使用redirect从vhost:80redirect到vhost:433(如http://wiki.apache.org/httpd/RedirectSSL )。 所以,现在,当有人只使用HTTP它直接到https。 这很好。 但。 当有人进入example_com / sub_example_com /它不redirect他。 我试过build立一个ServerAlias,但它没有工作。 对我来说这似乎有点古怪。 你将如何解决这个问题? 有可能不使用重写? 它可以在定义中完成吗? 提前致谢 PS。 我已经改变了短划线的地址,因为我不能发布两个以上的链接