dttphb59319 2013-10-25 01:12
浏览 196
已采纳

将.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 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了