301正在redirect,但它将旧url附加到新url的末尾,如下所示: http://www.example.co.uk/new-dir/new-page/?/old-dir/old-page/ 这是我的.htaccess RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.co.uk [NC] RewriteRule ^(.*)$ http://www.example.co.uk/$1 [R=301,L] Redirect 301 /old-dir/old-page/ http://www.example.co.uk/new-dir/new-page/ RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/$1 [L]
我有一个很奇怪的问题:谷歌给我的一些链接在我的网站地图不可访问,并给出了404错误。 不过,我试图打开有问题的网页,它工作正常。 该网站已build成使用codeigniter,这里是一个链接的样本 现在,如果您尝试打开上面的链接,它将正常工作。 但如果你试图curl -I : curl – 我http://widwebway.com/en/solutions HTTP / 1.1 404未find 我已经做了一些路线和重写规则,从URL中排除控制器名称。 换句话说,正确的链接是 curl -I http://widwebway.com/en/widwebway/view/solutions HTTP / 1.1 301永久移动 date:2012年2月29日星期三18:05:01 GMT 服务器:Apache / 2.2.14(Ubuntu) 地点:http://widwebway.com/en/solutions 变化:接受编码 Content-Type:text / html; 字符集= ISO-8859-1 Apache错误日志给出 文件不存在:/ var / www / myweb / en,referer:http://widwebway.com/en/solutions 我的.htaccess是: ErrorDocument 404 /index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^ar/widwebway/view/([a-z_]{1,50})[/]*$ /ar/$1 […]
$ ls Layouts Pictures index.html $ cat .htaccess RewriteEngine On #REDIRECT pages that are not specifically redirected RewriteCond %{HTTP_HOST} !^www\.mySite\.com$ [NC] RewriteRule ^(.*)$ http://www.mySite.com/$1 [R=301,L] # Some redirections here ErrorDocument 404 http://www.mySite.com/ DirectoryIndex index.html wrongWay.html Layouts/wrongWay.html IndexIgnore * Options -Indexes $ ls Pictures ABCDEFG 如果用户访问Pictures/A/ -directory列表,我希望用户会看到wrongWay.html或Layouts/wrongWay.html因为dir Pictures/A不包含index.html 。 我的第零个想法是上面没有工作的.htaccess。 然后,我的第一个想法是$ find . -type d -exec […]
我有一个复杂的问题,我试图解决。 我已经使用下面的.htaccess指令来启用某种漂亮的url,并且工作正常。 例如, http ://myurl.com/shop将被redirect到http://myurl.com/index.php/shop ,这是很好的工作(请注意,这样的东西,如myurl.com/css/mycss.css )不会redirect: RewriteEngine on RewriteCond ${REQUEST_URI} !^(index\.php$) RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^/?(.*)$ index.php/$1 [L] 但现在,我已经在我的网页上引入了SSL,我想要以下行为:除了admin.php和login.php外,我基本上都希望上述行为适用于所有页面。 对这两个页面的请求应该被redirect到HTTPS部分,而所有其他的请求应该按照上面的规定进行处理。 我已经拿出了以下.htaccess,但它不起作用。 h tps://myurl.com/shop不会被redirect到h tp://myurl.com/index.php/shop,h tp://myurl.com/admin.php不会被redirect到h tps ://myurl.com/admin.php。 RewriteEngine on RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !^(admin\.php$|login\.php$) RewriteRule ^(.*)$ http://%{HTTP_HOST}/${REQUEST_URI} [R=301,L] RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} ^(admin\.php$|login\.php$) RewriteRule ^(.*)$ https://myurl.com/%{REQUEST_URI} [R=301,L] RewriteCond %{REQUEST_URI} […]
WordPress为通过post编辑器上传的任何图片创build附件页面,并“附加”到该post。 迁移网站后,这些附件页面不复存在,现在我们有大约1000个链接指向404的链接。 所以,我正在寻找一种方法来对任何有/ attachchement /的string进行redirect,然后将这个url重新推回到一个级别(恰好是post页面)。 例如: http://mysite.com/2012/news/blog-post-title/attachment/image-page/ (不存在)将会去http://mysite.com/2012/news/blog-post-title/ (这确实存在)。 除了redirect一个级别之外,我还需要删除/ attachment /(在本例中为“图像页面”)之后的任何内容。 有什么build议么? 提前致谢
我只能提交.htaccess文件。 当我尝试在terminal上提交时,出现此错误: svn: PUT of '/svn_sr/!svn/wrk/2ce2c337-a371-411d-ae18-c39acaa2d846/trunk/crm/.htaccess': Could not read status line: Connection reset by peer (http://www.xxx.com) 当我尝试在zend-studio上提交时,出现以下错误: svn: Connection reset svn: PROPFIND request failed on '/svn_sr/trunk/crm/.htaccess' 我认为这是许可问题,但我不知道我该如何解决。 我在网上发现了一些关于这个问题的东西,但是我不明白或者我解决不了问题。 我的虚拟主机configuration: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName www.xxx.com DocumentRoot /home/umutftp <Location /svn_sr> DAV svn SVNPath /var/svn/sr AuthType Basic AuthName "Development area" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user </Location> <Directory /home/umutftp> […]
我需要能够将我们的网站进入维护模式,除了某些用户允许QA / Dev能够在维护模式下testing对站点/数据库的更改。 问题是每次我们做这个IP的列表都会发生变化,我们不能在每次我们做的时候用不同的IP列表来修改主要的apacheconfiguration文件。 我们可以对apacheconfiguration进行一次性修改,以便支持读入或使用一些其他具有例外列表的文件。 我有什么select提供Apache的IP列表不应该被redirect? 我们添加的.htaccess文件会这样做吗? 关键值对的文件呢? 我看着在Apacheconfiguration中做这样的事情: RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/maintenance.mode -f #RewriteCond %{REMOTE_ADDR} ## check list of exceptions?? RewriteRule !^maintenance/.*$ /maintenance/ [R,L]
这是我的.htaccess文件的内容: Options MultiViews Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.lventas.com$ [NC] RewriteRule ^(.*)$ http://lventas.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ http://lventas.com/negocio/$1 [L,QSA] ErrorDocument 404 http://www.lventas.com/404.php RewriteOptions Inherit 当到达根文件夹时,它不应该什么都不做,但它仍然redirect到: http://lventas.com/negocio/default.asp 什么是'default.asp'? 为什么要在那里?
我想重写http://example.com/apps/app4/step1.php到http://easyfanpageapp.com/apps/ 我用这个重写,但它不工作。 RewriteEngine On RewriteBase / RewriteRule ^apps/?$ ^(.*)\step1.php$ [NC,L] 也试过 RewriteRule ^apps/?$ apps/app4/step1.php$ [NC,L] 什么可能是错的?
我需要在htaccess中设置一个规则的帮助, 每当请求的URL包含关键字love然后redirect到另一个URL或maby显示一个404页面。 澄清更多:如果有人试图访问此URL – > www.domain.com/love或www.domain.com/?love或任何包含爱这个词的url应该被redirect到404页。