我有一个网站( the-tack-shop.co.uk ),我正在testing我的电子商务框架。 我试图使用共享SSLtesting付款: https : //web43.secure-secure.co.uk/the-tack-shop.co.uk/ 。 我不得不改变我的htaccess文件来使用SSL: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} secure-secure\. [NC] RewriteBase /the-tack-shop.co.uk/ RewriteRule ^[a-z0-9\-_/\.]*$ index.php [L] RewriteCond %{HTTP_HOST} the-tack-shop\. [NC] RewriteBase / RewriteRule ^[a-z0-9\-_/\.]*$ index.php [L] RewriteRule ^.* http://www.google.com [L] 这将与SSL域一起使用,但不与正常域一起使用。 注释掉第二个rewritebase,它将在普通域上工作,但不在SSL域上。 任何人都可以告诉我哪里错了吗?
我有一个共享的托pipe服务器上的网站。 我的目录布局看起来像这样 /home /user /public_html /pics /family public_html中有一个index.php文件。 我需要帮助编写.htaccess规则 当www.domain.org被请求时,服务index.php文件 请求www.domain.org/pics时强制用户回到public_html 允许用户在请求www.domain.org/pics/family时查看目录内容 我尝试了很多RewriteCond和RewriteRule的组合,但是我不明白这些文档和例子足以知道我想要做什么甚至是可能的。 Web服务器应用程序是Apache的某个版本。
在htaccess文件中,一个文件bla.php RewriteCond可以写出如此的权利? RewriteCond %{REQUEST_FILENAME} !bla.php 问题:怎样才能为多个文件写入RewriteCond? 例如3个文件: bla.php , some_bla.php , some_other_bla.php ?
我正在尝试configurationNginx,以便我可以从子目录(aka domain.com/phpmyadmin)访问PhpMyAdmin。 下面提供的代码似乎适用于我,虽然我不希望别名是/ phpmyadmin 。 location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } 如果我尝试更改位置名称 位置/ phpmyadmin {… 至… 位置/秘密{… 一切似乎都打破了。 我究竟做错了什么?
如果我写: <?php echo "SCRIPT_NAME: ".@$_SERVER['SCRIPT_NAME']."<br />"; ?> SCRIPT_NAME:/index.php 上面的行显示。 我正在使用这些重写行 RewriteCond %{SCRIPT_NAME} !^/index\.php$ RewriteRule .* http://example.com/404 [L] 我检查过: http://example.com/foo http://example.com/bar http://example.com/hdhd RewriteCond匹配,然后我redirect到404 [03/Aug/2013:13:07:48 +0200] [example.com/sid#23c3710][rid#263afe8/initial] (4) [perdir /var/www/vhosts/example.com/httpdocs/] RewriteCond: input='' pattern='!^/index\\.php$' => matched [03/Aug/2013:13:07:48 +0200] [example.com/sid#23c3710][rid#263afe8/initial] (2) [perdir /var/www/vhosts/example.com/httpdocs/] rewrite '404' -> 'http://example.com/404' [03/Aug/2013:13:07:48 +0200] [example.com/sid#23c3710][rid#263afe8/initial] (2) [perdir /var/www/vhosts/example.com/httpdocs/] implicitly forcing redirect (rc=302) with http://example.com/404 […]
我有以下urlwww.example.com/advice/现在注意在URL的末尾的斜线? 我希望将其移除为www.example.com/advice 。 现在,当我在浏览器中input该URL时,我将redirect到带有斜线的尾部,即使以curl为例。 现在我知道后面的斜杠正在增加,因为通知是一个实际的目录。 [steve@dev dev.www.example.com]$ curl -I https://dev.www.example.com/advice -k HTTP/1.1 301 Moved Permanently Date: Fri, 25 Nov 2016 08:20:11 GMT Server: Apache/2.4.6 (CentOS) Location: https://dev.www.example.com/advice/ Cache-Control: max-age=0 Expires: Fri, 25 Nov 2016 08:20:11 GMT Connection: close Content-Type: text/html; charset=iso-8859-1 [steve@dev dev.www.example.com]$ curl -I https://dev.www.example.com/advice/ -k HTTP/1.1 200 OK Date: Fri, 25 Nov 2016 […]
我正在重写PHP生成的缩略图与iglyurl到好的。 而不是img.php?src=bla.jpg&w=200&h=100静态文件名IMG-file_w200_h100.jpg 因为重写过程非常复杂,涉及到很多变化,所以只有从IMG开始的URL才能听取重写规则。 然而,有条件的第一条规则似乎不起作用:如果我将其更改为IMF或其他东西,它仍会触发重写规则! 任何想法,为什么条件不起作用? # Rewrite imgcpu?src= thumbnail maker to nice static urls RewriteCond %{REQUEST_URI} ^IMG.*$ RewriteRule ^IMG-(.+)_w(.+)_h(.+)_f(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3&f=$4 [L] RewriteRule ^IMG-(.+)_w(.+)_q(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&q=$3 [L] etc
我想要一个mod_rewrite规则,当stream量从内部networking到达networking服务器时不会被执行。 Web服务器是apache 2.2下面的RewriteCond是为了防止重写规则。 RewriteCond %{REMOTE_ADDR} !=192\.168\.[0-15]\.[1-255] 如果我使用ip 192.168.15.173访问web服务器,规则似乎没有踢,因此尽pipe我的内部地址执行重写规则。 我的错误在哪里? 匹配更简单: RewriteCond %{REMOTE_ADDR} !=192\.168\.15\.173 也失败了。 我使用http://httpd.apache.org/docs/trunk/rewrite/access.html中的“Blocking of Robots”示例来构build规则。 我错过了什么吗? 编辑:我已经试图调查使用重写日志,但没有提出任何有用的信息。 这是请求过程中发生的事情: 192.168.15.173 – – [12/Jun/2013:13:50:17 +0200] [example.com/sid#7f3c6afb5e30][rid#7f3c6f864b68/initial] (2) init rewrite engine with requested uri /test/ 192.168.15.173 – – [12/Jun/2013:13:50:17 +0200] [example.com/sid#7f3c6afb5e30][rid#7f3c6f864b68/initial] (3) applying pattern '^/test/(.*)' to uri '/test/' 192.168.15.173 – – [12/Jun/2013:13:50:17 +0200] [example.com/sid#7f3c6afb5e30][rid#7f3c6f864b68/initial] (2) rewrite […]
我一整天都在这里,我认为自己掌握了正则expression式,但是我不再相信自己能做到。 我搜遍了,阅读了一些关于mod_rewrite的可怕指南,我很难过。 我想让这个电话 subdomain.domain.com/u/satbirkira 看上去和上面完全一样,但是执行并显示它 domain.com/user.php?user_name=satbirkira?subdomain_given=subdomain 这应该是非常简单的,但我不明白。 以下是我想到的: RewriteCond %{HTTP_HOST} ^(.*)user.php\?user_name=(.*)$ [NC] RewriteRule ^(.*)$ http://%1%{REQUEST_URI}/u/$3 我不知道为什么一些RewriteCond中断,如果你删除无用的捕获点像第一个(。*),但我已经学会了滚动它。 我将不胜感激,如果有人会解释为什么方法是不正确的,语法,捕获点和replace以及variables。 编辑 它类似于http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html#4上的目标,“4)将yoursite.com/user.php?username=xyz改写为yoursite .com / xyz“期望答案对我来说没有任何意义。
我正在尝试创buildNginx的vhostconfiguration,其中将包括相当于OpenCart的Apache htaccess重写规则。 这是原始的: RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] 据我了解,这表示,如果请求不是一个文件,而不是一个目录,并不包含具有上述扩展名之一的文件,然后根据最后一行重写。 这是我目前在Nginx中使用的: location / { # This try_files directive is used to enable SEO-friendly URLs for OpenCart try_files $uri @opencart; } location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; } 这似乎工作,但我担心检查这些特定的文件不存在。 没有任何我能find的build议一种方法来复制该条件,而不使用IF。 我也不确定这部分条件的原因,也就是为什么这些特定的文件很重要。 我的问题是: 有没有办法做到这一点,即编写一个Nginx的条件相关的文件types,而不使用IFs? 如果我的Nginx例子的第一个位置块改为try_files $ uri […]