2013-10-25 01:12
浏览 191


Here is my URL for my website. http://localhost/GASS-2110/alarm-system/overview.php.I wanted to remove the .php extension so that the URL become like this;http://localhost/GASS-2110/alarm-system/overview. I paste the .htaccess file in my root directory, run the localhost, and i find its empty! i dont know why is this happening and i am not sure what did i do wrong. I believed that i need to configure something which i do not know what it is.What am i suppose to do? I am a beginner so please dont be harsh with me. where should i call the .htaccess file?

Here is what i put in my .htaccess file.

Options +FollowSymLinks -MultiViews

# Turn mod_rewrite on

RewriteEngine On

RewriteBase /

# To externally redirect /dir/foo.php to /dir/foo

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]

RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php

RewriteCond %{REQUEST_FILENAME}.php -f [NC]

RewriteRule ^ %{REQUEST_URI}.php [L]

p/s: sorry for my bad english

图片转代码服务由CSDN问答提供 功能建议

这是我网站的网址。 http://localhost/GASS-2110/alarm-system/overview.php 。我想删除.php扩展名,以便URL变成这样; http:// localhost / GASS-2110 /报警系统/概述。 我将.htaccess文件粘贴到我的根目录中,运行localhost,我发现它是空的! 我不知道为什么会这样,我不知道我做错了什么。 我相信我需要配置一些我不知道它是什么的东西。我想做什么? 我是初学者所以请不要对我很苛刻。 我应该在哪里调用.htaccess文件?


  Options + FollowSymLinks -MultiViews  
#转动mod_rewrite on 
RewriteEngine On 
RewriteBase / 
#将外部重定向/dir/foo.php外部重定向到/ dir / foo 
RewriteCond%{THE_REQUEST} ^ [AZ] {  3,} \ s([^。] +)\ .php [NC] 
RewriteRule ^%1 [R,L,NC] 
 ##内部重定向/ dir / foo到/ dir / foo  .php 
RewriteCond%{REQUEST_FILENAME} .php -f [NC] 
RewriteRule ^%{REQUEST_URI} .php [L] 

p / s:抱歉我的英文不好

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dongpin2969 2013-10-25 01:35

    When a change in .htaccess results in the page being empty this means there was an error parsing the file, most frequently because of typos or referring to a module that's not loaded. You can check the problem in the Apache error log - check the ErrorLog directive in the vhost config for its location, otherwise it's in the general Apache error log (on Linux usually /var/log/apache/error.log).

    If the error is something akin to Unknown option RewriteEngine you haven't enabled mod_rewrite correctly. On Debian/Ubuntu systems you can fix this by running a2enmod rewrite, for other systems the instructions could vary.

    解决 无用
    打赏 举报

相关推荐 更多相似问题