Stacey是一个轻量级的内容pipe理系统。 我在我的porfolio网站上使用它,但是它使用.htaccess文件来制作友好的url。 是否有可能重写这个.htaccess行在nginx中使用? 这里是.htaccess文件的内容; RewriteEngine on # Some hosts require a rewritebase rule, if so, uncomment the RewriteBase line below. If you are running from a subdirectory, your rewritebase should match the name of the path to where stacey is stored. # ie. if in a folder named 'stacey', RewriteBase /stacey #RewriteBase / ErrorDocument 404 […]
我有一个问题,这是我的规则: server { listen 80; server_name example.com; rewrite ^/(.*) http://example.com/$1 permanent; } 但是Firefox会抛出错误:无限反弹 我想重写www.example.com – > example.com
我有我的nginxconfiguration文件中的以下内容。 error_page 503 http:path-to-my.rackcdn.com/maintenance.html; Rackspace Cloudfiles上存储了一个静态html文件的服务器。 我不喜欢的是如何将url更改为… rackcdn.com。 我宁愿重写url,所以域似乎保持不变。 是否有可能重写错误页面的url类似的东西 mydomain/maintanence 谢谢。
我有以下问题: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. Apache试图到达不存在的文件。 这是我的.htaccess: RewriteEngine on Options +FollowSymlinks RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteCond %{REQUEST_URI} !^/subfolder/$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /subfolder/$1 RewriteRule ^\??$ index.php [L] 我打开了日志,在日志里有这样的: […]
我一直试图让这个工作几个小时,但没有什么似乎工作。 我已经有了一个Drupal站点,并且默认位置如下所示: # Default location location / { try_files $uri @rewrite; } location @rewrite { rewrite_log on; rewrite ^/(.*)$ /index.php?q=$1; } 这工作正常,最终的结果是,所有不直接指向根(如“example.com/subdir1”和“example.com/subdir1/subdir2”)的path被重写为index.php?q = [path]。 但是,恰巧我在网站上有几个子目录,它们是包含index.php文件的“真正的”子目录。 我想testing是否有任何给定的子目录确实有一个index.php,然后运行那个。 这是我认为会奏效的一个尝试: # Default location location / { try_files $uri @subdir @rewrite; } location @subdir { rewrite_log on; rewrite ^/(.*)$ $1/index.php; } location @rewrite { rewrite_log on; rewrite ^/(.*)$ /index.php?q=$1; […]
这是可能的,我怎么能重写http://192.168.1.1:4950/hello ,例如, http://home.hello 我知道如何使用.htaccess重写URL的一部分,但不知道如何重写整个地址,包括IP部分和端口。 这种重写只适用于内部/局域网使用。
如何防止一个位置被ssl重写匹配? server { listen 80; server_name example.net; location = /feeds/ { break; } rewrite ^ https://$server_name$request_uri? permanent; } server { listen 443; …
我想在我的.htaccess上做一个可扩展的RewriteRule,我使用斜杠前的每个单词作为参数。 例如: http://localhost/mysite/param1/param2/param3/…/param20 我正在使用这个代码(但是如果我想要6或7个参数,它会太长): Options +FollowSymLinks RewriteEngine on DirectoryIndex web.php?param1=inicio RewriteRule ^([a-zA-Z0-9_-]+)$ web.php?param1=$1 RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ web.php?param1=$1¶m2=$2 下一个rewriteRules会更长一些^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$/([a-zA-Z0-9_-]+)$/([a-zA-Z0-9_-]+)$/([a-zA-Z0-9_-]+)$ web.php?param1=$1¶m2=$2¶m3=$3¶m4=$4¶m5=$5 我将每个参数作为一个个体variables发送给php,并且我使用第一个参数来决定哪个页面必须显示在web.php上。 有什么办法可以缩短吗? 我不知道如何优化它。 我甚至不知道我是否正确。 你将如何做到这一点? 也许使用PHP? 谢谢。
我试图添加一个重写规则到我的htcaccess文件和有问题的部分是查询string。 我想将查询string参数pid添加到重写规则中。 这两行代码不起作用,如何为您设置查询string是重写规则。 RewriteRule browse/(.*)/?pid=(/d+) show_products.php?department=$1&pid=$2 RewriteRule browse/(.*)/?pid=([0-9]+) show_products.php?department=$1&pid=$2 应该看起来像 http://mysite.com/browse/department?pid=1 要么 http://mysite.com/browse/department/?pid=1 我已经做到了这一点,但它没有问号有没有人知道如何得到它有问号 RewriteCond %{QUERY_STRING} ^$ RewriteRule browse/(.*)/pid=([0-9]+)$ show_products.php?department=$1&pid=$2 http://mysite.com/browse/department/pid=1
下面的代码以这种forms构build一个url。 http://mysite.com/browse/department/?pid=1 这里是重写cond和规则 RewriteCond %{QUERY_STRING} ^pid=([0-9]+) RewriteRule browse/(.*)/$ show_products.php?department=$1&pid=%1 我想要的是有2个额外的参数,第一个是购买订单,第二个不一定在过滤url,所以url会是这样的 http://mysite.com/browse/department/?pid=1&order_by=a_z 或使用参数filter http://mysite.com/browse/department/?pid=1&order_by=a_z&filter=1 我如何有我的重写条件和我的重写规则