打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
9 @* g* W1 v1 |  a9 ^8 p+ V: }, {+ g4 I* W% l  S; p/ u1 E
http://pic.segaa.net/segaa5 `, R/ @5 \0 A5 s! y

; D, u* T$ Z' ^; J9 `  j自動相通於3 i4 |# q* Y% a- f! I1 \& |

+ v, Q( \8 K- Yhttp://pic.segaa.net/index.php?cat=10002$ o: Y. l- n) B) F6 A) C* O: l: C& U$ p

0 [  `# m5 D, N! O4 b讓使用者簡單的記住自己相簿的網址
2 i4 F! i' l/ x- R, i! D2 E
3 p7 i& e# f9 H: n  T3 H) B編輯index.php 加入以下這些2 p' Q5 ?: k1 ?  L1 E; B
cpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了 # w+ i. P, k, E, I4 a
" F; E* s0 l9 l, ~  V' H; b
) U9 n( m, T- x4 v0 a! r
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
" @6 R+ P8 y# A
. H  I; J: W" A2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去; I( ~4 m' z: w# K
    選擇覆蓋掉原本的 .htaccess 檔
! m4 O, Z- K/ X# Z0 Y
8 |' a( N9 f3 y. ^5 a% P3 d  E  E3 B3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去2 n# V: C4 r8 V/ q
9 n3 O2 g; L4 r+ y3 P; t" w8 _
下面是我目前的 .htaccess 檔 3 T; m6 y3 i+ K* x6 T

! h: n9 W: E0 c; nps.我將 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

其實關於精簡網址
. C* B" p, B) O/ ^, O* n' @4 t3 X這邊站長的教學寫的很清楚了8 ?) u' p' f4 Q& w
謝謝
; O$ p9 ]4 h$ a/ e' \
' w# l+ T$ u: G4 ]$ H8 I  H9 K8 G4 t9 I但是我照做之後
$ A; E8 N. R* M1 r4 b" p8 L不能連入相簿了
! T" P6 K, l) E- o8 }" |. R他告訴我這行有誤
& @$ N' q6 i% L$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
, ]( s+ c+ h7 b1 a: H% U2 Q2 `(上面的cpg134_users我改成cpg1410_users)# M( P6 k( F9 ]$ {( Q; j
7 i4 Q# [& Q7 O& J& U
請問一下我該如何解決?
, ?1 F1 Q% z% s+ t  t& \謝謝

TOP

sorry 太少上論壇看東西了
; x# p( @8 [1 N這邊原本是我用來丟些文件用的
/ {, ^+ a+ o/ q/ P1 T& F( Z關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
) w* y5 F) O: q/ b% N
. j1 H0 ^) e2 J& R% {3 |  b+ S2 ~8 @4 I# r/ S, ?
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表, x6 H" _+ `; Y2 w
其實關於精簡網址# c; Q+ w- Q( \8 y. |  q' V5 d2 Q
這邊站長的教學寫的很清楚了
8 |$ D  L7 p, x4 G. y" B- t謝謝8 N2 x$ F$ P; G) A  ~# }

' a9 G1 a! F+ ?9 w0 `但是我照做之後
7 C* _7 D& g1 k7 S9 p8 F不能連入相簿了
1 @7 E7 Z4 w1 \( j: A- F- M他告訴我這行有誤; e) j& ?8 f" }5 D0 s$ I' w
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶
# S+ b$ B; ]7 u8 Q说的太对了,赞同的赞同!!
, O5 \" M: a5 Q" `3 tRagnarok power leveling+ _  ~0 J& ]  ~( A3 C5 A
ro power leveling
% B2 P" J) ?$ A+ ]Ragnarok Online power leveling! X( b) V" G: q# q
有事者,事竟成;% W/ n" f* L8 S
破釜沉舟,百二秦关终归楚;
/ [) u. c+ {/ t7 G苦心人,天不负;# X5 y0 S1 K! l$ b5 A; T' a* y
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!( ]5 Z0 O0 C6 c5 S
/ c$ w+ g, `. x' E

; X- x! l" w1 ^* D4 W. O/ u9 G) X
  D. S+ @. @: P
9 U' b6 e1 Z# p; G, [2 O* M7 R9 R' ^, s" O' `2 g& a
# c' U* R1 g& H4 ^" u+ s3 b
4 n( b/ R# |% U( Q9 p# C. V  G
( c3 i0 E8 P9 ?: o: L
" g: G# s7 L& @9 H

8 s  R% ~( W0 k3 }. L
& Y- ~7 D) T' G, ?! @* e
) i8 }( Y- `, |8 g5 E8 a& t) H! _, k/ g  C7 y# n7 A9 A# g
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
5 B; w& A# B; Q, Q: B. f, _1 [+ a: P" N# q, r. O/ C9 z, G

& A/ t( a# _: g
& [+ Y  |  [9 Z% Y
' z. U' l3 k; x. U9 k- L  Z, \$ z/ x0 j" T: Q% j
2 T' V" r1 B' a( K! ^# U
8 h; }. @; ]$ a1 D
+ H5 m  |3 f$ w4 [$ h
1 ~. g3 \: X5 p$ r! h  x3 m1 z

' f5 E" n) D. ~' r9 Q/ i! y% v. R" L+ R# B" m

4 p% Y) |( }2 r  C! x# k% U. T/ }
# ]9 F8 R/ U9 B' }* C8 B3 _A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題