Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.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
Php 如何在Apache中重写简单的URL?_Php_.htaccess_Mod Rewrite_Yii2 Basic App_S3 Rewrite Rules - Fatal编程技术网

Php 如何在Apache中重写简单的URL?

Php 如何在Apache中重写简单的URL?,php,.htaccess,mod-rewrite,yii2-basic-app,s3-rewrite-rules,Php,.htaccess,Mod Rewrite,Yii2 Basic App,S3 Rewrite Rules,如果我有这样一个URL: 如何消除/web/index.php,使其成为http://localhost/sewacp 我写过。htaccess是这样的,但不起作用: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . web/index.php 试着按照规则来做 RewriteEngine On RewriteRule ^$ /sewac

如果我有这样一个URL:

如何消除/web/index.php,使其成为
http://localhost/sewacp

我写过。htaccess是这样的,但不起作用:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . web/index.php
试着按照规则来做

RewriteEngine On
RewriteRule ^$ /sewacp/web/index.php [QSA,L]

很有效,谢谢