簡體   English   中英

縮短動態網址的問題

[英]Issue shortening dynamic URLs

我已經搜索並嘗試了幾種可能的解決方案。

我首先開始:

http:// example.com/ 729/start-page.asp?cid=4004  
http:// example.com/ 729/start-page.asp?cid=7916

並嘗試:

http:// example.com/ johns-start-page  
http:// example.com/ judys-start-page

或者,如果可能的話:

http:// johns-start-page.example.com/  
http:// judys-start-page.example.com/

到目前為止,我已經:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^cID=4004$  
RewriteRule ^729\.asp$ /johns-start-page [NC,R=301,L]

RewriteCond %{QUERY_STRING} ^cID=7916$  
RewriteRule ^729\.asp$ /judys-start-page [NC,R=301,L]

只要您對這些內容進行硬編碼,就可以嘗試:

RewriteEngine On

RewriteCond %{THE_REQUEST} \ /+729/start-page.asp\?cid=4004($|\ |\&)
RewriteRule ^ /johns-start-page? [L,R=301]

RewriteCond %{THE_REQUEST} \ /+729/start-page.asp\?cid=7916($|\ |\&)
RewriteRule ^ /judys-start-page? [L,R=301]

RewriteRule ^johns-start-page$ /729/start-page.asp?cid=4004 [L,QSA]
RewriteRule ^judys-start-page$ /729/start-page.asp?cid=7916 [L,QSA]

對於子域,您需要確保已進行DNS設置,以將那些子域指向相同的IP地址。 然后是這樣的:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^johns-start-page\.example\.com$ [NC]
RewriteCond %{THE_REQUEST} \ /+729/start-page.asp\?cid=4004($|\ |\&)
RewriteRule ^ http://johns-start-page.example.com/? [L,R=301]

RewriteCond %{HTTP_HOST} !^judys-start-page\.example\.com$ [NC]
RewriteCond %{THE_REQUEST} \ /+729/start-page.asp\?cid=7916($|\ |\&)
RewriteRule ^ http://judys-start-page.example.com/? [L,R=301]

RewriteCond %{HTTP_HOST} ^johns-start-page\.example\.com$ [NC]
RewriteRule ^$ /729/start-page.asp?cid=4004 [L,QSA]

RewriteCond %{HTTP_HOST} ^judys-start-page\.example\.com$ [NC]
RewriteRule ^$ /729/start-page.asp?cid=7916 [L,QSA]

但是,除非您將它們設置為包括FQDN,否則所有鏈接都可能斷開。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM