简体   繁体   English

.htaccess重定向到另一个站点

[英].htaccess redirect to another site

hello all i am building a url shortener site where we create smart short urls for any long url the short url looks like this reurl.in/anji89jd. 您好,我正在建立一个网址缩短网站,我们在其中为任何长网址创建智能短网址,短网址看起来像这样的reurl.in/anji89jd。 whenever anyone clicks on this short url the user is directed to corrosponding long url which is stored in database and it is extracted by sql query on the index page everything is working good but i dont know how to direct the user to the long urls by htaccess 每当有人单击此短url时,用户将被定向到存储在数据库中的对应的长url,并且它通过索引页上的sql查询提取,一切正常,但我不知道如何通过htaccess将用户定向到长url

look if the short link is reurl.in/abcd then the index page is designed like this reurl.in/index.php?r=abcd and then it directs the page to new site if i type this url everyhing works well 查看短链接是否为reurl.in/abcd,然后将索引页面设计为此reurl.in/index.php?r=abcd,然后如果我键入此url,则它将页面定向到新站点,一切正常

but reurl.in/abcd dosent works please help me i know this can be done by .htaccess 但reurl.in/abcd剂量工作正常,请帮助我,我知道这可以通过.htaccess完成

i have tried like 我尝试过

 RewriteEngine on
 RewriteRule ^index/([0-9]+)/?$ index.php?r=$1 [L,QSA]

Try: 尝试:

Options -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?r=$1 [L,QSA]

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

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