【php – .htaccess重写子目录不起作用】教程文章相关的互联网学习教程文章

php – 如何允许.htaccess密码保护的网址类型?【代码】

我的网站有.htaccess密码保护.现在我想允许该站点的一些URL. https://www.exampale.com受密码保护.但我不想要任何密码弹出窗口显示https://www.exampale.com/test/page/ {变量} 这可能在.htaccess文件中吗? 需要反向Password protect a specific URL解决方法:您可以将它与mod_setenv指令结合使用,如下所示:# set variable NO_PASS if URI starts with /test/page/ SetEnvIfNoCase Request_URI "^/test/page/" NO_PASS# Allow NO_...

php – htaccess阻止访问目录但允许访问文件【代码】

我有这样的情况.我正在开发Zend Framework中的应用程序,htaccess指向每个请求index.php文件.如果请求路径上存在某个文件或目录,则htaccess允许访问此文件,如css,js,images等… 现在我有这样的链接: example.com/profile/martin-slicker-i231 使用Zend Router,它指向控制器帐户和操作viewprofile.我想为我的用户添加一些avatart,并在公共文件夹中创建目录(因此服务器可以访问图像,如css和js).该目录名为“profile”,其中的子目录是...

PHP / Apache:使用.htaccess重写规则【代码】

我对mod_rewrite有点困境.如何编写将决定以下内容的规则: 如果我浏览/ en / page / page我想将其重写为: index.php的语言= EN&放大器;页= /页 但如果我只浏览/页面,我想将其重写为: 的index.php?页= /页 这可能吗? 编辑:/ page只是一个随机的动态页面名称,它也可以是任何东西. 我需要一个规则来检查/ se ==一个字符串,并且不超过2个字符> / page – > index.php?lang = se& page = / page如果浏览页面/页面,它会注意到/ pa...

php – Htaccess和水印【代码】

我想知道是否可以通过使用.htaccess添加水印来保护我的主机中从外部加载的图像? 也就是说,如果另一个站点在他们自己的网站中的img标签中使用我的图像URL http://example.com/1.jpg. 计划是当外国请求来到我的主机时,我向它添加水印并将其发送给浏览外国站点的用户.解决方法:您基本上想要做的是从本教程开始: http://www.alistapart.com/articles/hotlinking/ 这将向您展示如何将来自外部站点的图像重定向到PHP页面.然后,您可以使...

php – .htaccess重写子目录不起作用【代码】

我想重写我的网址:http://mysite.com/index.php?node=home&photoID=10至:http://mysite.com/home/10目前,仅为http://mysite.com/home我用RewriteRule ^([^/]*)$index.php/?node=$1 [L]但是当我尝试使用时RewriteRule ^([^/]*)/([^/]*)$index.php/?node=$1&id=$2 [L]它似乎没有正确加载我的页面,页面没有样式或任何东西. (另外,我的.htaccess文件的顶部有:RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{R...

使用WHERE子句,Access,ODBC和PHP变慢【代码】

我通过PHP中的odbc_connect在DSN上执行以下查询:SELECT Orders.Brand, Orders.AdFolderFROM OrdersLEFT JOIN MPC_Agents ON Orders.UserName = MPC_Agents.UserNameWHERE Orders.AdFolder = '$udf'直接在MS Access中运行时,结果是即时的.当通过odbc_execute($conn,$query)运行时,速度非常慢,但是会在一段时间后执行. 当取出WHERE语句时,它会相当快,尽管在Access SQL控制台中运行的速度与WHERE语句的速度相同. 任何人都可以帮助确...

php – Silex路由.htaccess webroot【代码】

我正在使用Silex“微框架”来进行应用程序的路由.我目前仍然坚持如何使用.htaccess重写网址. 标准Silex网址:localhost / myapp / web / index.php / hello / name 我希望它看起来像:localhost / myapp / hello / name 使用以下.htaccess代码,我可以省略/index.php/部分.但我仍然需要使用/ web / part.RewriteEngine On RewriteCond %{THE_REQUEST} /myapp/web/index.php/ RewriteRule ^/myapp/web/index.php/(.*) /myapp/$1 [R=3...

php – Htaccess将目录重写为文件【代码】

# php_value session.cookie_domain .rhr.fm# Enable Rewrite Engine RewriteEngine on#Create friendly URL RewriteRule ^(data|cache)($|/) - [L]RewriteRule ^([^/]+) index.php?page=$1 [L]你好再次Stackoverflow! 我想在我的网站上重定向SEO的URL,那www.example.com/about www.example.com/?page=about和www.example.com/about/ www.example.com?page=about但dirs数据和缓存被排除在外,所以www.example.com/data/js/page.js不...

php – 防止htaccess影响ajax请求【代码】

我正在尝试修改我的htaccess请求,它当前加载了所有php文件,但删除了.php扩展名.但是我注意到这会影响我的ajax请求,因为我无法从它们获取任何POST数据.我将什么添加到我的htaccess中以防止特定的php(data.php)不受htaccess的扩展删除的影响? 我的htaccess的代码:RewriteEngine On# browser requests PHP RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php RewriteRule ^/?(.*)\.php$/$1 [L,R=301]# check to see if the re...

php – Htaccess新行崩溃页面【代码】

我最近尝试使用htaccess隐藏我的网址中的参数,结果是500服务器错误. 这是我的.htaccess代码:<files .htaccess>order allow,denydeny from all </files> Options -Indexes +FollowSymLinks RewriteEngine on RewriteBase / ErrorDocument 404 /404.php RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{THE_REQUEST} \s(.+?)/+[?\s] RewriteRule ^(.+?)/$/$1 [R=301,L] RewriteBase / RewriteRule ^([^/]+...

php – .htaccess ErrorDocument重定向【代码】

我是Apache和.htaccess的新手,我有一个关于如何使用Apache的ErrorDocument命令处理403和404错误的简单问题. 让我们看看我写的早期CMS中的代码:ErrorDocument 404 /admin/includes/access_deny.php?error=404当他们收到404错误时,这将默默地将用户重定向到http://www.mysite.com/admin/includes/access_deny.php?error=404. 这是我的问题,关于.htaccess文件,此错误文档将始终位于同一位置.但是,如果我需要移动我的安装,比如说到目录...

使用htaccess使PHP文件上传安全【代码】

我正在开展一项任务,使PHP文件上传安全,我的客户希望遵循http://www.acunetix.com/websitesecurity/upload-forms-threat.htm网站上的指南提及 我们能够遵循本网站上提到的所有指南,接受htaccess规则.他们提到要做以下事情.Define a .htaccess file that will only allow access to files with allowed extensions. Do not place the .htaccess file in the same directory where the uploaded files will be stored. It should be ...

php – .htaccess所有分页的一般规则【代码】

如何使用.htaccess从http://domain.com/recent?page=2(原始页面为http://domain.com/?id=recent\u0026amp;page=2)中获取页面变量? (我需要所有页面的一般规则)thanx求助解决方法:将重写规则更改为:RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^([^/]+)/?$index.php?id=$1 [L,QSA]密钥更改是使用QSA标志,即使在添加id = $1后也会保留原始查询字符...

php – .htaccess在localhost上给出500错误【代码】

我是MVC框架的初学者.我正在尝试根据教程创建一个我自己的. 他们提供的.htaccess文件包含:RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$index.php?url=$1 [QSA, L]我收到500服务器错误:服务器遇到内部错误,无法完成您的请求.服务器过载或CGI脚本中存在错误. 我检查了httpd.conf以检查是否没有评论mode_rewrite.有人可以帮...

php – 会在.htaccess中重写规则会影响网站的速度吗?【代码】

我计划在主目录中添加最多10个.htaccess重写网址代码会影响我网站的执行(网站加载时间)吗? 我当前的.htaccess文件是Options +FollowSymLinks RewriteEngine On RewriteRule ^([0-9]+)/([0-9]+)/([^.]+).html index.php?perma=$3 RewriteRule ^movies/([^.]+).html gallery.php?movie=$1 RewriteRule ^album/([^.]+).html gallery.php?album=$1 RewriteRule ^img/([^.]+)/([^.]+).html gallery.php?img=$2 RewriteRule ^movies.htm...