Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/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
Mod rewrite 用斜杠替换get变量_Mod Rewrite - Fatal编程技术网

Mod rewrite 用斜杠替换get变量

Mod rewrite 用斜杠替换get变量,mod-rewrite,Mod Rewrite,我想通过使每件事变得更简单来摆脱url栏中的id。有人能告诉我如何制作这样的/math/calculation/limits\u topic/vidname使用下面的.htaccess文件: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php 将get方法变量传递给URL,然后将其分解 $variable

我想通过使每件事变得更简单来摆脱url栏中的id。有人能告诉我如何制作这样的/math/calculation/limits\u topic/vidname

使用下面的.htaccess文件:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php
将get方法变量传递给URL,然后将其分解

$variables = explode("/",$_SERVER['REQUEST_URI']);
例如:

actual url : http://example.com/math.php?calculus=1&limits_topic=1&vidname=1
rewrite url : http://example.com/math/1/1/1

使用下面的.htaccess文件:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php
将get方法变量传递给URL,然后将其分解

$variables = explode("/",$_SERVER['REQUEST_URI']);
例如:

actual url : http://example.com/math.php?calculus=1&limits_topic=1&vidname=1
rewrite url : http://example.com/math/1/1/1

Url重写是你最好的朋友。每个主要的web框架都可以。下一个问题。Url重写是你最好的朋友。每个主要的web框架都可以。下一个问题。