dttphb59319
dttphb59319
2013-10-25 01:12

将.htaccess文件和localhost变为空

已采纳

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

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongpin2969 dongpin2969 8年前

    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.

    点赞 评论 复制链接分享