Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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 Htaccess重写规则以具有友好的URL_Php_Apache_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

Php Htaccess重写规则以具有友好的URL

Php Htaccess重写规则以具有友好的URL,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,我正在使用godaddy托管,我的域指向名为“abc”的目录 我在“abc”目录下创建了一个目录“temp”,并在“temp”目录下放置了一个.htaccess文件 我想重写url如下 http://www.mywebsite.com/temp/VARIABLE_VALUE/VARIABLE_FILENAME.php?id=12&c=usa 到 my.htaccess文件由以下代码组成 Options +FollowSymLinks RewriteEngine On RewriteRu

我正在使用godaddy托管,我的域指向名为“abc”的目录 我在“abc”目录下创建了一个目录“temp”,并在“temp”目录下放置了一个.htaccess文件

我想重写url如下

http://www.mywebsite.com/temp/VARIABLE_VALUE/VARIABLE_FILENAME.php?id=12&c=usa

my.htaccess文件由以下代码组成

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([^-]*)$ /temp/index.php?var=$1 [L]

但是,它给了我404错误。

您可以在

Options +FollowSymLinks
RewriteEngine On
RewriteBase /temp/

RewriteRule ^([^/]+)/([^.]+\.php)$ $2?var=$1 [L,QSA]
Options +FollowSymLinks
RewriteEngine On
RewriteBase /temp/

RewriteRule ^([^/]+)/([^.]+\.php)$ $2?var=$1 [L,QSA]