Apache 使用.htaccess更改url
我有一个类似“abc.com/1_en-Application.html”的网站。现在我想把它改成abc.com/Application.html 我有。我喜欢Apache 使用.htaccess更改url,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我有一个类似“abc.com/1_en-Application.html”的网站。现在我想把它改成abc.com/Application.html 我有。我喜欢 重新启动发动机 重写规则^([0-9]+)-([0-9]+)(.*)-(.*).html$index.php?id=$1&page=$2&lang=$3[L] 重写规则^([0-9]+)wRule(.*)-(.*).html$index.php?id=$1&lang=$2[L] 在现有重写规则下面添加3行: RewriteCond
重新启动发动机
重写规则^([0-9]+)-([0-9]+)(.*)-(.*).html$index.php?id=$1&page=$2&lang=$3[L]
重写规则^([0-9]+)wRule(.*)-(.*).html$index.php?id=$1&lang=$2[L]
在现有重写规则下面添加3行:
RewriteCond %{REQUEST_URI} /application.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^application.html$ index.php?id=1&lang=en [L]
- 如果web根目录中没有名为
的真实文件,这将重写URL并在内部将其指向application.html
index.php
- 如果
是一个真实的文件,则会显示该文件。在这种情况下,这3行仍然有效,但不需要包含application.html
abc.com/application.html
一个实际文件,还是应该将其路由到/index.php
?