我在 WOULD NOT WORK 区域中的 mod 重写规则有问题 :) 我有一个项目站点,女巫只是一个 ajax 返回站点。所以我喜欢在 sitename.com/my-test/project/test.html 上打开我的网站,并且会重写 sitename.com/my-test/project.html?index=test。我知道在我重写之后,cms 的重写规则必须完成他的工作。我不确定这可能是问题所在,他们交叉或崩溃。
如果我通过浏览器浏览 URL,一切都会正常工作,只有重写规则不起作用,我变得非常疯狂,找不到问题。
所以我希望有人能帮助我。
在 .htaccess 中重写配置
RewriteEngine On
RewriteBase /
#### WOULD NOT WORK ######
# REWRITE AJAX PROJEKT
RewriteCond %{REQUEST_URI}% ^my-test/projects/[a-zA-Z0-9]+\.html$ [NC]
RewriteRule ^my-test/projects/[a-zA-Z0-9]+\.html my-test/projects.html?index=$1
### WORK CORRECTLY ####
# REWRITE RULE FOR SEO FRIENDLY IMAGE MANAGER URLS
RewriteRule ^files[0-9]*/imagetypes/([^/]*)/([^/]*) index.php?rex_img_type=$1&rex_img_file=$2
# DON'T REWRITE IF REAL FILE, FOLDER OR SYMLINK EXISTS
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
# EXCLUDE SPECIFIC FOLDERS FROM REWRITE ENGINE
RewriteCond %{REQUEST_URI} !/files[0-9]*/
RewriteCond %{REQUEST_URI} !/assets/.*
RewriteCond %{REQUEST_URI} !/media/.*
RewriteCond %{REQUEST_URI} !/redaxo/.*
# REWRITE ALL OTHER REQUESTS TO INDEX.PHP
RewriteRule ^(.*)$ index.php?%{QUERY_STRING} [L]
我也测试过
RewriteCond %{REQUEST_URI}% ^/my-test/projects/[a-zA-Z0-9]+\.html$ [NC]
RewriteRule ^/my-test/projects/[a-zA-Z0-9]+\.html my-test/projects.html?index=$1
#OR JUST
RewriteRule ^/my-test/projects/[a-zA-Z0-9]+\.html$ my-test/projects.html?index=$1
#OR
RewriteRule ^/my-test/projects/(.*)$ my-test/projects.html?index=$1
#AND CORRECT
RewriteCond %{REQUEST_URI} ^/my-test/projects/[a-zA-Z0-9]+\.html$ [NC]
RewriteRule ^/my-test/projects/[a-zA-Z0-9]+\.html my-test/projects.html?index=$1
#AND ---
RewriteRule ^my-test/projects/([a-zA-Z0-9]+)\.html my-test/projects.html?index=$1 [L]
我没有找到答案,所以我真的希望有人可以帮助我
谢谢你们
吴莫克斯