如何提取的404错误在PHP中的URL参数(How to extract URL parameters on 404 Error in PHP)

   IT问题网   2019-04-23 00:00:00

问 题

我有我的htaccess重定向到一个error404.php,但我想在php文件能够提取原始url参数。

例如:

http://mywebsite.com/unknownfile.phpparam1=value1amp;param2=value2
 

我已经试过 $ _ get ['参数1'] 但这是空的。该 $ _ server ['php_self'] 只显示error404.php

在预先感谢。

解决方案

您可以通过 $访问原始网址_ server ["request_uri"] 。

例如:请求网址 /日冰/喵键=伦巴不存在。该 $ _ server ["request_uri"] 将有一个字符串,你可以用的 parse_url()函数分裂成几部分,并使用其他功能(如爆炸()来获得个人的查询串参数。

标签:如何提取错误过错毛病谬误中的参数



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

使用mod_rewrite工作不更改显示的URL结构(Change Displayed URL Structure using mod_rewrite NOT Working)

problem i need to change the structure of the displayed c ...

有条件的.htaccess(Conditional .htaccess)

problem i'm sure there are other threads on similar topic ...

重定向的站点根目录使用的.htaccess子目录(Redirecting root of site to subdirectory using .htaccess)

problem a site of mine has all the files stored in a subd ...

的.htaccess URL重写 - 删除的.php去除WWW。转换?ID = 10/10(.htaccess url rewrite - remove .php remove www. convert id=10 to /10)

problem as the title says, i need a quite com ...

从Symfony的1.4路径删除“网络”共享托管?(Remove 'web' from Symfony 1.4 path on shared hosting)

problem i've found a lot of helpful information about ins ...

小问题.htaccess文件?(small problem with .htaccess file)

problem i have a small .htaccess file which allow me to r ...

的.htaccess基于查询字符串重定向和删除查询字符串(.htaccess redirect based on query string and remove query string)

problem i'm in need to have redirect instruct ...

htaccess的导致服务器错误500(htaccess causing server error 500)

problem i have a zend framework application w ...

404 htaccess的重定向不工作(404 htaccess redirect is not working)

problem i am running tomcat on apache we server. i am put ...

通过重定向某些变量的任何页面(Redirect any page passing certain variables)

problem i'm putting a search engine on my site, and the s ...

与RewriteMap指令的MapType DBD问题(Problems with RewriteMap MapType dbd)

problem continuing from another discussion he ...

重写URL时,一个表单提交(rewrite url when a form is submitted)

problem question regarding redirection using htaccess. on ...

从URL preventing直接访问(Preventing direct access from url)

problem in one of my work i need to build a feature for u ...

的.htaccess不会影响到其他文件夹(.htaccess not affecting other folders)

problem i have a .htaccess file that affects my subdomain ...

mod_rewrite的错误:[客户127.0.0.1]文件不存在(mod_rewrite error: [client 127.0.0.1] File does not exist)

problem i want to start using mod_rewrite so i can use fr ...

重写全球htpasswd的密码保护(Overriding global htpasswd password protection)

problem i am testing a drupal site on a development serve ...

PHP路径包含文件(PHP Path to Include Files)

problem i have a site with an index.php. the index.php ha ...

重写URL隐藏的index.php并作出查询不错(Rewriting url to hide index.php and to make query nice)

problem i had developed project with custom mvc architect ...

htaccess的URL路由的PHP MVC?(htaccess URL routing for PHP MVC)

problem i've been searching and have yet to find an artic ...

的.htaccess规则相应的HTTP链接,HTTP和HTTPS重定向到HTTPS?(.Htaccess rules to redirect respective HTTP links to HTTP and HTTPS to HTTPS)

problem first, here's the .htaccess rule i cu ...