Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Url .htaccess重写问题_Url_.htaccess_Mod Rewrite - Fatal编程技术网

Url .htaccess重写问题

Url .htaccess重写问题,url,.htaccess,mod-rewrite,Url,.htaccess,Mod Rewrite,我将如何改变 http://website.com/file.php 到 谢谢。在大多数apache服务器部署中,您可以在文档根目录上创建.htaccess,其中包含: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ $1.php 只要“文件”与任何现有目录不匹配,这将起作用。实际上,重写规则应该

我将如何改变

http://website.com/file.php


谢谢。

在大多数apache服务器部署中,您可以在文档根目录上创建.htaccess,其中包含:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1.php

只要“文件”与任何现有目录不匹配,这将起作用。

实际上,重写规则应该是
RewriteRule^(.*)/$$1.php
你能告诉我为什么一旦我把这个iin放进去,CSS就被删除了吗?我可以检查你的网站是否可以通过互联网访问。
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1.php