打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
- q: o5 Q) V: x9 h0 @. }+ a: i3 h4 g6 @7 k3 t
http://pic.segaa.net/segaa4 |0 }9 _/ k! _0 }  o( u/ s9 E
. I: r' R6 x# e) d( l
自動相通於6 Y1 W6 O  H$ i; M8 N: r8 O$ ]& H3 W

! o  S; h) a4 _- w; ]  whttp://pic.segaa.net/index.php?cat=100028 ?' ~) O1 l" j# o

  d4 {2 a. D" z& l6 [" s+ u% f7 p讓使用者簡單的記住自己相簿的網址
4 H  W, i0 `" U& }* D0 A) g5 M. ^, o& i) a' k" ^
編輯index.php 加入以下這些
# O! M4 ]- E, |& O8 Rcpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了
4 O' a! A2 u5 U# r  [8 W4 c. F- K" X
) N" [& b# _( _! }$ d5 _
! \7 Z( Q. q) |# ^' ]1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
2 _% o7 Z- \4 \' D: U6 C: a
0 G' i( x- r/ C' m0 K2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
9 b& e' g7 r- A+ T: Y9 n    選擇覆蓋掉原本的 .htaccess 檔
- U0 n# g  ^, f& D$ P" ]* i; M" D7 |" P0 R1 p5 M) |
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
" R; f& P/ f5 r, T
. E" J! y' t' ?+ s下面是我目前的 .htaccess 檔
1 X8 C! X( S# g" @' k8 q0 Z/ g4 j, ], U3 Y! q' P- j# ~, l
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

其實關於精簡網址
/ a+ t, t- Q* z6 {4 @! w這邊站長的教學寫的很清楚了5 U) w8 h+ C6 F+ w
謝謝3 E0 G+ F# ?: H- m: C( U

) Z% j7 I8 G$ A' ~* Q但是我照做之後
* V2 @& g6 m+ @9 `# J不能連入相簿了
' n. C9 b# |/ W他告訴我這行有誤
+ c9 r6 Q: c2 y+ D. b7 e$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";3 P3 y0 Y6 X7 @* d8 R
(上面的cpg134_users我改成cpg1410_users)
% ?( G% _( V8 C8 _* H& p7 I; W/ D; E3 f! n& G  I$ R
請問一下我該如何解決?
+ M7 X2 p9 |5 s( [. r( g8 d. e" G謝謝

TOP

sorry 太少上論壇看東西了
, H, ]2 Z( _+ h4 S這邊原本是我用來丟些文件用的
5 s; {! y' d- y: Z關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱# Z9 h+ \  W7 T# v7 l

- r5 ~8 I$ N; y) l- z
5 @9 Q$ o; n. W( i! V7 Y( T
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表( D4 q5 g* G! n1 Z
其實關於精簡網址" b0 K( o/ I# B. y, `
這邊站長的教學寫的很清楚了# O" G/ p5 ^, r) _: q4 i6 @
謝謝
! r  v* P/ B  F# a5 g- y/ L& T  ^* ^
; {  }; p$ n4 _6 H# B2 B) H( d8 j但是我照做之後8 R2 o7 Z) A4 ]6 T# d# U0 K
不能連入相簿了
" `# d3 o' S' P& f3 F他告訴我這行有誤  P  ?# z; a# A# j. V) h
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


' R" ~7 u5 u3 K' |9 X7 Z说的太对了,赞同的赞同!!) W$ c% s4 u# K& e
Ragnarok power leveling
' P2 [! [) `* _# L. y2 C1 h/ A- m+ q6 Ero power leveling
1 l8 t( R' t% w! s) y' gRagnarok Online power leveling
4 c2 g1 H4 ^: V! q: ]有事者,事竟成;- g. m( n1 o) J' A* s7 C
破釜沉舟,百二秦关终归楚;
8 |; @9 d/ m7 `& ^: V/ F" e苦心人,天不负;' B) E# G( x% X% L9 }% c
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!' ]7 m' a8 @8 [: d8 |0 o( L8 t

7 L# y8 ?- v7 N/ q" d
% ?- C# T( t1 N7 l: T7 a6 a" g2 h0 Q0 ?7 n# E) f; c
4 h3 [: a+ s. a' F! n) g

* |# M2 p$ l! {4 v
5 ]; d2 B  G7 O6 e0 ^* [, V- d9 @; `! D# N2 a8 Q/ {% L

  k8 G$ P2 ^* G* P7 i4 `9 M/ T& n+ F3 U" l) B1 u3 b) v( F* d
) E. R' u6 e# ?" B) G  d) L

( |; d; O5 m6 h/ n# M
9 B, Y# _3 \' a3 W6 \7 h. M$ h- \0 V. P# I
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
$ j3 p2 i5 G6 r9 b+ x' c6 s) k+ m" e
+ s$ R; \0 H. `8 {1 f% s( @' D& h( f! U; N. v: ~2 X( Q+ l
2 m8 w! P# f& j. `- z+ O& s

7 l! U2 S' d: R3 l% Z5 ?: g4 i* d1 M/ q; W' F
0 y* {9 j7 D" G) v* r1 O
2 X4 n( K5 [8 F) C1 h$ i  i
0 N+ b' U5 U7 d& B

$ K8 z; S  B- ?) P& h( l$ D9 L) ^6 b7 M( A" s
5 {3 C: Q! o# o$ w0 u
6 D, \0 i, R6 l8 E6 k
- |% y% z, U. R' u
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題