简体   繁体   English

变量无法通过PHP中的.htaccess成功重定向后获得

[英]variable not getting after successfully redirect via .htaccess in php

this is my .htaccess code 这是我的.htaccess代码

here in last line i redirect my user with a variable . 在最后一行,我使用变量重定向用户。 it redirect successfully for example 例如,它成功重定向

RewriteEngine on

RewriteBase /
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?technotch.in [NC]
RewriteRule .(jpg|jpeg|png|gif)$ - [NC,F,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([A-Za-z0-9-_]+)$ $1.php [QSA,NC,L]
RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ $1.php?product=$2 [QSA,NC,L]

</IfModule>

( http://technotch.in/Online-Certification/abc ) to ( http://technotch.in/Online-Certificate.php?product=abc ) http://technotch.in/Online-Certification/abc )到( http://technotch.in/Online-Certificate.php?product=abc

but on my php page the variable product in not getting with the code $_GET['product']; 但是在我的php页面上,变量产品未获得代码$ _GET ['product'];。

i has been check my .htaccess redirection on (htaccess.madewithlove.be) here it resolve it redirect url completely so please guide me what i do? 我一直在(htaccess.madewithlove.be)上检查我的.htaccess重定向,在这里它完全解决了重定向网址的问题,所以请指导我该怎么做?

From what I can see, your RewriteRule works as follows: 据我所知,您的RewriteRule的工作方式如下:

http://www.website.com/page is interpreted as http://www.website.com/page.php http://www.website.com/page解释为http://www.website.com/page.php

and

http://www.website.com/xxxx/xxxx/page/item is interpreted as http://www.website.com/page.php?product=item http://www.website.com/xxxx/xxxx/page/item解释为http://www.website.com/page.php?product=item

Is this what you are trying to achieve? 这是您要达到的目标吗?

EDIT: 编辑:

Apologies, I read it incorrectly, try doing a var dump on the requested page and see what vars you get. 抱歉,我看错了,尝试在请求的页面上进行var dump,看看得到了什么var。

Also, try changing [QSA, NC, L] from both to [QSA] since [L] means that it should stop processing any other rules below. 另外,请尝试将[QSA,NC,L]都更改为[QSA],因为[L]表示它应停止处理以下任何其他规则。

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

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