打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
3 B( w  v. g& D4 T) ]* t5 x" u; a* u4 }: g8 r: [/ {  G
http://pic.segaa.net/segaa
# _8 u. p* Q& l  k$ k& c& \
6 ?' G# M* e2 ?% @$ T! K自動相通於: E- o6 \0 J; A3 }0 R2 {$ G
% W: A* d: o- w
http://pic.segaa.net/index.php?cat=10002# U* Q' F7 a) e. v3 f( Q$ @
! E4 s- N6 O8 V1 ?2 J- v% Z
讓使用者簡單的記住自己相簿的網址
3 E* B4 ~( D. q  a, h  q9 p. N+ S8 ?5 S8 J8 H
編輯index.php 加入以下這些
3 e$ T6 H1 E6 m+ `# S: {2 X' fcpg134_user <- 這邊請自行修改
複製內容到剪貼板
代碼:
$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,'=') and !empty($qq)) {
$qq = eregi_replace ( '%20', ' ', $qq);
$qq=mysql_escape_string($qq);
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
$result1 = mysql_query($sql);
if (mysql_num_rows($result1)>0) {
list($uid) = mysql_fetch_array($result1);
$cat = sprintf("1%04d",$uid);
}
mysql_free_result($result1);
}





//
// Main code
//
編輯 .htacess
複製內容到剪貼板
代碼:
<Files .htaccess>
deny from all
</Files>

RewriteEngine On
RewriteBase /
RewriteRule ^([A-Za-z_0-9-]+)/*$ /?$1 [L]
RewriteRule ^user-([0-9a-zA-Z]+)$ /index.php?cat=$1
RewriteRule ^user/([0-9a-zA-Z]+)$ /index.php?cat=$1
RewriteRule ^user/$ /index.php
RewriteRule ^my$ /profile.php?op=edit_profile
RewriteRule ^new$ /thumb.php?album=lastup
RewriteRule ^hot$ /thumb.php?album=topn


<Files user>
ForceType application/x-httpd-php
</Files>

#ErrorDocument 401 /index.php
#ErrorDocument 403 /index.php
#ErrorDocument 404 /index.php

TOP

進階的精簡網址 ... 基本上直接開啟外掛就好了
2 E5 x* C, C% @( W$ C  |) t
9 w/ ]% d, N5 O! ]/ k
$ ~1 ~, c8 Q% o* Y$ P1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
  {8 t+ R$ P6 I7 j% ^
' }' d! ~2 R+ B2 _9 f) }# Y2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
6 `. H' }5 u, x" ], |1 r    選擇覆蓋掉原本的 .htaccess 檔 ) {. `$ a. M4 |

; ~3 e3 D0 x. `9 v3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
1 n8 m6 h6 ~) |3 e) d# l- P9 v; P/ M7 ]1 Q
下面是我目前的 .htaccess 檔
* M/ s. w6 E( C  ~. n2 d# H4 J( i0 f# r- E
ps.我將 displayimage.php 改成 display.php thumbnails.php 改成  thumb.php
複製內容到剪貼板
代碼:
<Files .htaccess>
deny from all
</Files>


Options FollowSymLinks SymLinksIfOwnerMatch

RewriteEngine on

RewriteEngine On
RewriteBase /
RewriteRule ^([A-Za-z_0-9-]+)/*$ /?$1 [L]
RewriteRule ^user-([0-9a-zA-Z]+)$ /index.php?cat=$1
RewriteRule ^user/([0-9a-zA-Z]+)$ /index.php?cat=$1
RewriteRule ^user/$ /index.php

#  Uncomment the following line if your webserver's
#  URL is not directly related to physical file paths.
#  Update "YOUR_COPPERMINE_ROOT" (just / for root)

#RewriteBase /YOUR_COPPERMINE_ROOT

#
# Rewrite index urls
#
RewriteRule index-([0-9]*)\.html index.php?cat=$1 [NC]

RewriteRule index-([0-9]*)-page-([0-9]*)\.html index.php?cat=$1&page=$2 [NC]

#
# Rewrite thumbnail urls
#
RewriteRule thumbnails-([a-z0-9]*)-([\-]?[0-9]*)\.html thumbnails.php?album=$1&cat=$2 [NC]

RewriteRule thumbnails-([a-z0-9]*)-page-([0-9]*)\.html thumbnails.php?album=$1&page=$2 [NC]

RewriteRule thumbnails-([a-z0-9]*)-([\-]?[0-9]*)-page-([0-9]*)\.html thumbnails.php?album=$1&cat=$2&page=$3 [NC]

RewriteRule thumbnails-([0-9]*)\.html thumbnails.php?album=$1 [NC]
RewriteRule thumb-search-(.*)\.html thumb.php?album=search&search=$1 [NC]

#
# Rewrite displayimage urls
#
RewriteRule displayimage-([a-z0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)\.html displayimage.php?album=$1&cat=$2&pos=$3 [NC]

RewriteRule displayimage-([a-z0-9]+)-([\-]?[0-9]+)\.html displayimage.php?album=$1&pos=$2 [NC]

RewriteRule displayimage-([0-9]+)\.html displayimage.php?pos=-$1 [NC]

RewriteRule slideshow-([0-9]+)-([\-]?[0-9]+)-([0-9]+)\.html displayimage.php?album=$1&pid=$2&slideshow=$3 [NC]

RewriteRule slideshow-([a-z]+)-([\-]?[0-9]+)-([0-9]+)-([0-9]+)\.html displayimage.php?album=$1&cat=$2&pid=$3&slideshow
=$4 [NC]

RewriteRule display-([a-z0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)\.html display.php?album=$1&cat=$2&pos=$3 [NC]

RewriteRule display-([a-z0-9]+)-([\-]?[0-9]+)\.html display.php?album=$1&pos=$2 [NC]

RewriteRule display-([0-9]+)\.html display.php?pos=-$1 [NC]

RewriteRule slideshow-([0-9]+)-([\-]?[0-9]+)-([0-9]+)\.html display.php?album=$1&pid=$2&slideshow=$3 [NC]

RewriteRule slideshow-([a-z]+)-([\-]?[0-9]+)-([0-9]+)-([0-9]+)\.html display.php?album=$1&cat=$2&pid=$3&slideshow=$4 [
NC]

<Files user>
  ForceType application/x-httpd-php
  </Files>

  #ErrorDocument 401 /index.php
  #ErrorDocument 403 /index.php
  #ErrorDocument 404 /index.php

TOP

其實關於精簡網址
- G, e% B: n& y5 e這邊站長的教學寫的很清楚了
" `% @0 B% y* m0 ^- q  T8 e, _謝謝' T& d0 l9 B. ~7 Z7 x- U

- |. J$ x5 K' t: X* h0 y但是我照做之後
, P4 `7 D: N+ q不能連入相簿了
+ [3 Z9 S; Q  J8 N) S( O9 G他告訴我這行有誤
  d7 v% L/ D$ `3 s$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
4 f% D2 P( Q6 r- V$ }4 z- x(上面的cpg134_users我改成cpg1410_users)
7 u' }  i: K- k/ z8 H; W' V! ]) A5 N3 \3 J# K# s- o1 y( H
請問一下我該如何解決?" p  Z1 ]1 G- A2 L" h) ^
謝謝

TOP

sorry 太少上論壇看東西了 , g3 B' u) D4 w. v
這邊原本是我用來丟些文件用的 ; V9 d( z& z4 j/ ]  I6 q
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱$ t; Y6 i& q2 m0 @& F8 W, _/ t2 U

. w) |* @1 d* u, t/ n4 f1 i2 i
3 @8 q( O! h3 V7 s7 {, @
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表0 Y1 W( E4 B0 O) ?3 @/ G8 F
其實關於精簡網址
5 u, u' b/ P( M$ w  U這邊站長的教學寫的很清楚了2 A6 l: M2 X9 p+ o. f
謝謝- d7 t' C  X" s5 x
- K8 A& O$ _$ Z: _2 Y
但是我照做之後6 f" h5 l, j) P: E2 \4 s
不能連入相簿了
1 O- y# E0 O8 W$ F" B他告訴我這行有誤
( p4 t5 j8 j# H7 i2 O( {+ X2 V$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

2 }+ u) S9 E+ r- @# s  M
说的太对了,赞同的赞同!!7 Q: k8 d) T  }/ u9 R
Ragnarok power leveling
6 g- h3 U* ~, {0 i* Aro power leveling! V% K3 R. a& b) \
Ragnarok Online power leveling* @# k2 \: {7 }! Y: }
有事者,事竟成;
! O  p% j  _' i3 k3 Y& _+ {破釜沉舟,百二秦关终归楚;% ?  a& f* u0 W/ Q0 Y
苦心人,天不负;9 U- }' `& D+ ^: q% m' W7 g
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
, X7 t! C! ~9 w- l! R6 I9 }
' ^: Y& j; y! i9 U$ _% E9 K
/ [: I: z% A( N8 R; R$ E+ F/ o. x/ V
. M" F6 \7 X% y& H. w, L
0 A! m* |$ n+ ]
4 H4 ~, h) u6 W4 y% Y& M

4 }3 q2 n( t4 m' q' \0 H5 r5 _2 o# [" C. c. a* F" O
# \9 {( @5 n, u5 H2 ~! ~

% N8 H+ t8 }# f1 ^$ p* V* o
: r1 @6 i: M; K+ ?+ z6 }8 x8 d8 m3 o/ _+ F

4 n# J4 ^% Z& C, J8 W" |5 E高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!. |/ F8 y% E# ?! }4 g) ~8 V4 H6 ^% c# _

7 b* \6 S$ z1 K+ Q# ~7 G# E( ^
8 I0 C! \' ]% V3 J8 W4 D" L8 `* z! U; @& |
5 z  ~0 F/ p1 L. O- f/ J- `

$ G! z7 c  \. q4 o: W9 h0 O2 ^* J9 g# }1 z5 x# q8 K8 u
; l% E7 [+ v6 {* i. I" m3 [/ U9 f$ r
& {  ]9 A, ^; G
4 w3 m1 o3 A7 n# u* C# l
" d' u1 [& U6 z, |+ Q$ ?

7 I9 Q9 v2 n4 w  c- N) [! H% f/ L4 y
$ Q$ u1 a* P5 Q# \2 _
( g+ m8 v% u' d& U7 s  B" EA333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題