Setting up a bunch of short/friendly redirect URLs

前端 未结 1 1545
心在旅途
心在旅途 2021-01-17 01:11

I need to setup hundreds of short redirect URLs which follow this format:

http://mysite.com/shorturl

which will redirect to

http:

相关标签:
1条回答
  • 2021-01-17 01:55

    Is there a reason why you didn't want to do something like making

    http://mysite.com/shorturl
    

    redirect to

    http://mysite.com/index.php?id=shorturl
    

    And index.php can look up the correct id in the database from the shorturl and do the right thing.

    Obviously, to do this, all you'd need is one line in your .htaccess:

    RewriteRule ^([A-z,0-9,_,-]+)/?$    index.php?id=$1 [PT]
    
    0 讨论(0)
提交回复
热议问题