【问题标题】:Capital letters URL with cPanel?带有cPanel的大写字母URL?
【发布时间】:2017-07-17 22:35:41
【问题描述】:

我的网站有这个链接,但是当我把 hello 改成 HELLO 时,找不到页面

www.mywebsite.com/hello

我搜索了很多关于大写字母 URL 的问题。答案基本一样,就是设置.htaccess和设置RewriteMap httpd.conf。我的网站使用的是 cPanel 62.0.15,我认为我无法访问 httpd.conf。我在任何地方都没有找到那个文件。 有没有其他方法可以让大写字母 URL 正常工作?或者我在哪里可以找到 cPanel 中的 httpd.conf 文件?

我的 .htaccess

Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  
RewriteBase /

RewriteRule ^(.*)$ index.php?xparam=$1 [QSA,L]

</IfModule>

【问题讨论】:

  • 只需在您的应用程序代码中调用$xparam = strtolower($_GET['xparam'])

标签: html .htaccess url cpanel


【解决方案1】:

如果您将 NC 添加为 RewriteRule,那么这会使匹配不区分大小写:

RewriteRule ^(.*)$ index.php?xparam=$1 [QSA,L]

变成..

RewriteRule ^(.*)$ index.php?xparam=$1 [QSA,L,NC]

更多信息请见https://httpd.apache.org/docs/current/rewrite/flags.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-27
    • 1970-01-01
    • 2011-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-24
    相关资源
    最近更新 更多