Tag: .htaccess

mod_rewrite的隐藏function

似乎有很多mod_rewrite线程在最近漂浮在它的某些方面工作有点混乱。 因此,我编写了一些关于常用function的注释,也许还有一些烦人的细微差别。 你使用mod_rewrite运行了哪些其他function/常见问题?

我怎样才能删除“public / index.php”在URL生成laravel?

基本上我需要从laravel生成的URL中删除index.php或public/index.php ,通常path是localhost/public/index.php/someWordForRoute ,它应该像localhost/someWordForRoute htacces <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redirect Trailing Slashes… RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller… RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php[L] 应用程序/configuration/ app.php 'url' => 'http://localhost', 我该如何改变?

全部redirect到index.php htaccess

我对这个话题的第1000000个问题表示歉意,但是我不能按照我想要的方式来工作。 我正在写一个简单的php mvc'ish框架。 我希望这个框架能够被安装在任何目录中。 我的PHP脚本是什么:抓住请求uri并将其分解成段。 使第1部分为控制器,第2部分为动作。 这一切都很好,当我这样做: http://www.domain.com/mvc/module/test/ 它将转到特定的模块控制器和方法。 现在我有一个默认的控制器,在家里的文件夹的家庭控制器。 现在,当我直接访问这个文件夹http://www.domain.com/mvc/home/它将显示一个403禁止,因为这个文件夹确实存在,相反,它也应该回到http://www.domain.com /mvc/index.php 如果我将该框架安装在不同的文件夹中,可以说文件夹框架,它必须redirect回http://www.domain.com/framework/index.php 我想将每个文件夹和php文件redirect到index.php,其他所有事情都是这样。 我遇到的第一个问题是,它永远不会redirect到正确的文件夹,总是到域根文件夹。 这是我试过的: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L] 我真的希望有人能帮助我,或者指引我走向正确的方向! 非常感谢!!

全部拒绝,只允许通过htaccess一个IP

我试图拒绝所有,只允许一个IP。 但是,我想有以下的htaccess为单个IP工作。 我没有find一种方法来同时工作:拒绝所有,只允许一个,加上以下选项: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #When your application […]

htaccess的Angular路线redirect

我有几个路线的angular度应用程序,如: site.com/ site.com/page site.com/page/4 使用angular的html5路由模式,当你点击应用程序中的链接时,这些方法可以正确parsing,但是当你进行硬刷新的时候,当然是404错误。 为了解决这个问题,我尝试了一个基本的htaccess重写。 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_METHOD} !OPTIONS RewriteRule ^(.*)$ index.html [L] 这适用于angular度请求,但是当我尝试加载脚本或在我的域内进行ajax调用时,例如: <script src="/app/programs/script.js"></script> 这个脚本不加载 – 它的请求被redirect,它试图加载index.html页面,因为.htaccess认为它应该重新路由请求 – 不知道这个文件是否存在,它应该加载文件,而不是redirect。 有什么办法可以让htaccess的请求redirectindex.html(与视图参数)只有当没有一个实际的文件,它应该解决?

htaccess重写查询string

好吧,我很新,我真的很感谢一些帮助,谢谢! 我如何正确地重写.htaccess? 所以我有一个查询string在我的url: /?url=contact 我想要做的就是删除查询string /contact 帮帮我? 我search谷歌,我现在正在学习语法,但事实依然存在..我不知道如何做到这一点。 谢谢大家

如何禁用目录浏览?

我想禁用/ galerias文件夹和所有子目录的目录浏览 / galerias / 409的索引 * Parent Directory * i1269372986681.jpg * i1269372986682.jpg * i1269372988680.jpg

如何防止Apache httpd(MAMP)中的http文件caching

我正在MAMP中开发一个单页的Javascript应用程序。 我的JavaScript和HTML模板文件正在请求之间caching。 有一个简单的方法来表明,我想要防止http文件cachingMAMP吗? 可能与一个.htaccess文件? 在Mac上,我在哪里放置.htaccess或修改MAMP的虚拟主机?

通过PHP的HTTPauthentication注销

什么是注销HTTP身份validation保护的文件夹的正确方法? 有解决方法可以实现这一点,但它们有潜在的危险,因为它们可能是有问题的,或者在某些情况/浏览器中不起作用。 这就是为什么我正在寻找正确和干净的解决scheme。

没有指定input文件

我正在运行Anchor CMS ,我刚刚升级到0.8版本。 当我尝试运行安装程序时,出现“没有指定input文件”错误。 我相信这很可能是一个.htaccess的问题,但我不知道什么是正确的设置。 我的网站可以在这里find。 我的.htaccess被设置为: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase {base} # Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Rewrite all other URLs to index.php/URL RewriteRule ^(.*)$ {index} [L] </IfModule> <IfModule !mod_rewrite.c> ErrorDocument 404 index.php </IfModule> 如果有帮助,我也使用GoDaddy作为托pipe服务提供商。