简体   繁体   English

.htaccess重定向页面[自定义URL]

[英]page redirect with .htaccess [custom URLs]

I want to make a referral system, but it's based on a referral system to find the value it had in the database, and I want to redirect the user's page with this code. 我想创建一个参照系统,但是它基于一个参照系统来查找它在数据库中具有的值,并且我想使用此代码重定向用户页面。 I tried to explain the structure of the link should be at the bottom. 我试图解释链接的结构应该在底部。 How do we do this? 我们如何做到这一点?

DATABASE --> USERCODE(A6465S) --> example.com/A6465S(USERCODE) --> USER PAGE(REDIRECT) --> site.com/users.php?id=10 --> COMPLETED 数据库-> USERCODE(A6465S)-> example.com/A6465S(USERCODE)->用户页面(重定向)-> site.com/users.php?id=10->已完成

Try this in your root/htaccess file : 在您的root / htaccess文件中尝试一下:

#turn on the engine for rewriting
RewriteEngine On

#if the request  is for a existing file or directory, then skip the rewrite rule
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

#Rewrite the short url
RewriteRule ^([a-zA-Z0-9]+)/?$ /users.php?id=$1 [QSA,L]

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

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