Articles of .htaccess

RewriteRule不工作.htaccess

我的apache httpd.conf文件有以下内容 NameVirtualHost 11.91.91.97 <VirtualHost:11.91.91.97> ServerName creditrepair.com DocumentRoot /var/www/credit <Directory /var/www/credit > DirectoryIndex app.php Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> </VirtualHost> 在我的信用文件夹我有.htaccess文件,其中包含以下内容 < IfModule mod_rewrite.c > RewriteEngine On RewriteBase /creditrepair RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ app.php [QSA,L] RedirectMatch ^/$ /app.php/ < /IfModule > 我想实现的是, ipnum/credit/app.php/home被重写为ipnum/credit/home 我已经启用mod_rewrite。 它不工作,我不知道为什么。 有什么build议么?

mod_rewrite之后的一个cname

我有域名foo.bar.example.com。 foo是bar.example.com下的许多子子域中的一个。 我需要捕获并redirect以“/ special /”开头的foo.bar.example.com上的所有链接。 foo.bar.example.com/asdf < – 不应该redirect foo.bar.example.com/special/asdf < – 应该redirect otherfoo.bar.example.com/special/asdf < – 应该redirect 我在.htaccess中使用了以下代码,将foo.bar.example.com/special/asdf成功redirect到special.example.com/foo/asdf。 RewriteCond %{HTTP_HOST} (.*?)\.bar\.example\.com RewriteRule ^/special/(.*)$ http://special.example.com/%1/$1 [L,NC,QSA] 真棒,一切正常。 有什么问题? 我有很多合作伙伴(this.that.com,silly.billy.com等),已经build立了CNAME的指向我的匹配子子域(that.bar.example.com,billy.bar.example.com等)。 我需要this.that.com/special/asdf也可以redirect到special.example.com/that/asdf,而不需要伙伴做任何额外的修改。 不幸的是,我目前还没有能力testing这个function。 从我所了解的mod_rewrite基于浏览器input的内容而不是它获取到的内容。 如果这是真的,那么我将无法使用我的域名命名标准? 我不能依靠我的合作伙伴来遵循类似的标准。 我怎样才能得到this.that.com/special/asdfredirect到special.example.com/that/asdf?

服务器,数据库或代码问题? Magento后端重写自己的index.php不工作

我会诚实地承认,我在magento.stackexchange.com交叉发布,但原因是,我认为这是一个服务器故障,现在我正在寻找证据,以呈现给我可怕的托pipe服务提供商,GoDaddy … 当我登入时,突然间,我的巨匠正在做一个梦 mysite.com/mixitup/ login后,它变为 mysite.com/index.php/mixitup/dashboard/index/key/812b0641da…. etc, 但是如果我改变path mysite.com/mixitup/dashboard/index/key/812b0641da… etc 然后显示dasboard,但是在点击任何东西,如目录>pipe理产品index.php再次插入,离开 mysite.com/index.php/mixitup/catalog_product/index/key/f0e2d249eca781e… etc 陡然,这突然影响了一个服务器上的2个独立的magento站点。 他们共享一个.htaccess文件的路线,但是这并没有改变,导致问题。 这是一个godaddy共享服务器,所以我的select是有限的。 任何想法可能改变了这一点? 或如何解决它? 这是我的.htaccess文件的副本(遗憾转储) ############################################ ## uncomment these lines for CGI mode ## make sure to specify the correct cgi php binary file name ## it might be /cgi-bin/php-cgi # Action php5-cgi /cgi-bin/php5-cgi # AddHandler php5-cgi .php ############################################ ## GoDaddy […]

使用.htaccess参数重写防止redirect循环

让我首先说我不是一个.htaccess或Apache专家。 但是我需要在URL查询的末尾附加散列术语。 例如: http://www.example.com/?query_string=stuff 变 http://www.example.com/?query_string=stuff#otherstuff 我正在使用以下规则(整个.htaccess文件): RewriteCond %{QUERY_STRING} ppw_confirm=(.*) RewriteRule ^/?(.*) http://www.example.com/?ppw_confirm=%1#go [NE,L] 问题 将#go添加到参数string的末尾后,.htaccess文件仍会读取?ppw_confirm =查询。 然后尝试执行第二次redirect,然后发生无限循环。 我一直在寻找几个小时,没有运气。 基本上,我需要一种方法来防止.htaccess重写两次,从而防止这个无休止的循环。 打开任何和所有的build议:) 任何帮助是极大的赞赏。 提前致谢!

如何强制一个子域作为默认域,但保持其他子域的工作?

我在http://www.example.com上安装了WordPress网站,在http://test.example.com上安装了另一个WordPress网站。 我用这个.htaccess代码成功地将http://www.example.comredirect到了http://beta.example.com : RewriteCond %{HTTP_HOST} !^beta\.example\.com RewriteRule ^(.*)$ http://beta.example.com/$1 [R=301,L] 但是,当尝试访问http://test.example.com它会强制它发生http://beta.example.com/test/并显示404错误。 有没有办法让这个testing版redirect,但仍然保持我的WordPress网站http://test.example.com工作?

.htaccess域目录不能正确parsingdomain.com/domain

我有2个域指向相同的IP foo.com和bar.com 我没有权限为域设置虚拟主机,但是我已经设法创build了.htaccess规则,以便像这样设置。 foo.com指向/目录 bar.com指向/ bar目录 现在有了上面的设置,我可以有不同的index.html文件来访问域的根目录。 这是我为bar.com实施的规则 RewriteCond %{HTTP_HOST} ^(www\.)?bar\.com$ RewriteCond %{REQUEST_URI} !bar/ RewriteRule ^(.*)$ bar/$1 [L] 上面的规则完美地工作,但是当我浏览到bar.com/bar它不给我一个404 ,而是它仍然指向我的bar目录的根。 所以,我创build了另一个RewriteCond来处理这个问题。 RewriteCond %{HTTP_HOST} ^(www\.)?bar\.com$ RewriteCond %{THE_REQUEST} "(GET|POST) \/bar\/ HTTP/" 而RewriteCond完美的工作。 我不知道什么重写规则我会写,所以当用户访问bar.com/bar它会指向/bar/bar目录,因此会给我一个404 我试过下面的RewriteRule ,但似乎没有工作 RewriteRule ^bar/(.*)$ bar/bar/$1 [L,QSA] 所以我暂时创build了一个redirect到主bar.com域。 RewriteRule ^bar/(.*)$ http://bar.com/$1 [L,QSA,R=301]

RewriteCond如果带有parametername的文件夹存在

我想做一个子域redirect,如果一个文件夹与键入子域相同的名称存在。 例如我有一些像www.mysite.de/mainpage/hui.php文件夹结构,并希望能够通过mainpage.mysite.de/hui.php访问它 不过,我想让它只有在有一个文件夹主页的时候才能做到这一点,并为其他文件夹做。 如果该文件夹不存在,我想回退到当前的htacces采取子域,并将其用作index.php的参数。 这部分迄今为止运作良好。 所以,我已经做了类似的事情 RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule mainpage/([^/?]*)/?(.*)$ http://$1.mysite.de/$2 [L,R] 那将URI从www.mysite.de/mainpage/hui.php改为mainpage.mysite.de/hui.php ,但我也想让页面从mainpage.mysite.de/hui.php访问。 所以,我想也许是这样的 RewriteCond %{HTTP_HOST} ^(.*).mysite.de$ mainpage/$1 -d RewriteRule mainpage/([^/?]*)/?(.*)$ http://$1.mysite.de/$2 [L,NC,QSA] 当然这个代码不起作用,但是有人知道如何做到这一点?

htaccess不在服务器中redirect

我有一个.htaccess文件从URL中删除request.php问题。 我的htaccess文件是 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # deal with php5-cgi first <IfModule mod_fcgid.c> RewriteRule ^(.*)$ request.php?/$1 [QSA,L] </IfModule> <IfModule !mod_fcgid.c> # for normal Apache installations <IfModule mod_php5.c> RewriteRule ^(.*)$ request.php/$1 [L] </IfModule> # for Apache FGCI installations <IfModule !mod_php5.c> RewriteRule ^(.*)$ request.php?/$1 [QSA,L] </IfModule> </IfModule> </IfModule> htaccess文件(和所有文件)位于localhost / firstDirectory […]

文件名是透明地redirect到file-name.php

如果我请求/文件名我得到/file-name.php的内容回来。 我想知道这是如何发生,但似乎无法弄清楚。 我清空了.htaccess,它仍然在做。 我证实,我清空的.htaccess是正确的,在其中放置“zzz”,导致内部服务器错误,如我所料。 我在/ etc / apache2 / sites-enabled的httpd.conf文件中找不到任何东西。 有任何想法吗?

AuthType摘要领域密码空白问题

我有一个问题,我试图设置一个testing目录来validation使用AuthType摘要。 我已经能够成功完成这个,但只有当.htaccess的AuthName是一个string条目。 示例.htaccess: Options +Indexes AuthName "Gordon" AuthType Digest AuthDigestDomain / AuthDigestProvider file AuthUserFile C:/xampp/htdocs/HTAccessible/test/htdigest/.htpasswd <Limit GET POST PUT> require valid-user </Limit> 例如.htpasswd go_admin:'Gordon':0acefe7c35fab863f9a03f2e3f88f168qNG0 如果我将.htpasswd和.htaccess AuthName中的Realm更改为“Gordon and”..我得到这个错误(来自Apache logs / error.log) [Sat Aug 24 15:14:27.864534 2013] [auth_digest:error] [pid 6840:tid 1716] [client 127.0.0.1:49646] AH01790: user `go_admin' in realm `Gordon and' not found: /HTAccessible/test/htdigest/ 我已经尝试包装单引号和双引号的领域无济于事,目前编辑使用Notepad ++,但也尝试通过ht_digest.exe工具创build…仍然没有骰子。 我也看过Apache的AuthType和ht_digest文档,但也许它不是正确的部分,因为我似乎无法find任何信息包含空白的领域。 任何指针或build议,将不胜感激,谢谢。