Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 在htaccess文件中使用modrewrite进行URL转发_.htaccess_Redirect_Mod Rewrite - Fatal编程技术网

.htaccess 在htaccess文件中使用modrewrite进行URL转发

.htaccess 在htaccess文件中使用modrewrite进行URL转发,.htaccess,redirect,mod-rewrite,.htaccess,Redirect,Mod Rewrite,我目前正在修改.htaccess文件,但需要帮助 URL应该全部重定向 大字符应转换为小字符。 如果被调用的地址存在,则应直接调用该文件。 所有其他不存在的地址都应转发到Index.php 现在称为以下链接: www.example.com/test1/test2/test3.html example.com/TeST1/TEST2/test3.html www.example.com/test1/test2/test3 转发应始终调用Index.php,地址行中应包含以下内容: http:

我目前正在修改.htaccess文件,但需要帮助

URL应该全部重定向

大字符应转换为小字符。 如果被调用的地址存在,则应直接调用该文件。 所有其他不存在的地址都应转发到Index.php

现在称为以下链接:

  • www.example.com/test1/test2/test3.html
  • example.com/TeST1/TEST2/test3.html
  • www.example.com/test1/test2/test3
转发应始终调用Index.php,地址行中应包含以下内容:
http://example.com/test1/test2/test3.html

如果我有变量(
example.com/TeST1/TEST2/test3.html?id=6&test=hello
),当然也应该传输这些变量

为了使我的CSS文件和图像能够正确集成,我想我必须停用某些文件类型的转发。 以下文件夹应排除在重定向之外:css、媒体、img

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d    
RewriteCond %{SCRIPT_FILENAME} !-f   
RewriteRule ^.*$ /index.php [L,QSA]
有人可以写这个文件或帮我写吗?

试试:

RewriteEngine On

RewriteMap lc int:tolower
RewriteCond ${REQUEST_FILENAME} !-d
RewriteCond ${REQUEST_FILENAME} !-f
RewriteRule (.*[A-Z].*) /${lc:$1} [R=302,L]
# if you encounter double slashes, remove the slash before ${lc...

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.html [QSA,L]

你好,谢谢你的帮助。不幸的是,代码无法正常工作。我应该在日志文件中查找错误。但是那里什么都没有。我使用子域。这会导致dedm错误吗?另一个代码部分起作用。