简体   繁体   English

mod_rewrite之后的PHP网址

[英]PHP url after mod_rewrite

Is there a way to get the actual url of a file after mod_rewrite using PHP or Curl? 有没有一种方法可以使用PHP或Curl在mod_rewrite之后获取文件的实际URL?

BASIC EXAMPLE 基本例子

This --> example.com/test 这-> example.com/test

I want this --> example.com/test.php 我想要这个-> example.com/test.php

$_SERVER["REQUEST_URI"]; will give you original REQUEST_URI 会给您原始的REQUEST_URI

$_SERVER["REDIRECT_URL"]; will give you redirected URL. 将为您提供重定向的URL。

Assuming you are just using [L] in your rewrite rule. 假设您只是在重写规则中使用[L]

尝试$ _SERVER ['PHP_SELF']包含警告和一些替代方法: http : //www.mc2design.com/blog/php_self-safe-alternatives

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM