Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
.htaccess Htaccess mod_rewrite:如何将page.php更改为/page?_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess Htaccess mod_rewrite:如何将page.php更改为/page?

.htaccess Htaccess mod_rewrite:如何将page.php更改为/page?,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,简单问题: domain.com应该指向index.php 和domain.com/lala(或任何其他单词)应该指向products.php?name=lala 谁能告诉我重写规则吗 谢谢假设您的.htaccess文件位于web根目录/中 RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d # not a dir RewriteCond %{REQUEST_FILENAME} !-f # not a file

简单问题:

domain.com应该指向index.php

和domain.com/lala(或任何其他单词)应该指向products.php?name=lala

谁能告诉我重写规则吗


谢谢

假设您的
.htaccess
文件位于web根目录
/

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d # not a dir
RewriteCond %{REQUEST_FILENAME} !-f # not a file
RewriteRule ^(.*)$ products.php?name=$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^ index.php [R=301,L]

你好,谢谢。我收到一个内部服务器错误。里面可能有错误吗?