打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
, M& W6 w4 J& ~9 y5 @9 ]/ i$ P7 m6 e. I8 k( n
http://pic.segaa.net/segaa, Y9 w, ]& `  }2 J3 d: z! W9 e

5 r# m8 D/ F& i$ C: r7 i自動相通於
$ U& |$ S* p+ d# I8 V: M: I# q
3 s- ], r7 A, Qhttp://pic.segaa.net/index.php?cat=10002
- q( h0 o4 T2 L2 J2 T$ Z- W) c" m, Z2 X1 ]( P
讓使用者簡單的記住自己相簿的網址 / e$ E$ ^& F% ]# f  f, F" ]1 ~

0 n0 {; z5 {  m/ [8 B: g5 |編輯index.php 加入以下這些9 O& r' x+ W+ R9 W
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

進階的精簡網址 ... 基本上直接開啟外掛就好了
- X/ f5 p0 P8 m! D; w
. V3 e7 d- N2 L! @( p2 D
# ?# C/ @1 p: |0 {7 G6 Q5 q9 g, \1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 - T& J% |2 z, {" n# h! s. w

/ ?) r6 T9 y7 k. P; O: ]2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去* p5 k! p5 Q! T
    選擇覆蓋掉原本的 .htaccess 檔
2 n/ [7 b$ R6 R# H
+ g5 ]7 H4 S/ U; M3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去: Y7 q8 I% w" g9 g

, v4 ?- L4 L2 F2 R下面是我目前的 .htaccess 檔
% M4 R9 w( N' ^& J  O
7 _7 M5 N% h0 w6 |3 ~6 yps.我將 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! m4 B6 t- I8 D這邊站長的教學寫的很清楚了
8 g5 d% z& A/ E# g" u謝謝: }! ~+ ?5 }" a: I! u* _

0 p2 w3 u; N/ K) x9 A; P但是我照做之後/ b% H7 Z8 r+ G+ ~4 A
不能連入相簿了
+ n9 `( Z) V  J% b  t他告訴我這行有誤' A; N" W9 j" }; M3 `" d& G1 a3 _
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
9 ^4 n% a  X4 C0 j# H# J(上面的cpg134_users我改成cpg1410_users)+ B) C) ]( K! w; F: `5 p

3 @- ^, z. e' I/ C# Q  Z; ^: Q請問一下我該如何解決?7 A7 a/ B, L2 F0 \% f' K
謝謝

TOP

sorry 太少上論壇看東西了 . f6 m7 N/ q5 A/ G- Y8 u2 H
這邊原本是我用來丟些文件用的
( j1 S5 G# F( x關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
: [7 {4 {* f$ n! X$ ^2 X
4 \8 y$ _* b( S+ F9 l9 ^- o2 G6 ?* v9 F2 M( ~0 q$ d
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表  z/ {3 y- m; {/ m
其實關於精簡網址
4 W# k  ]6 b! \! J這邊站長的教學寫的很清楚了3 Z* i/ l4 T# ~* C
謝謝: }9 t7 }% j; {- i

1 U% q* f, c% Q) _但是我照做之後' J9 Y, U: i6 T7 P
不能連入相簿了& }" S) i% U' S; z$ T6 [0 Z" ~- w
他告訴我這行有誤) l! P: ^/ C6 ^- X+ O8 S  y
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶# ?  ~4 c" ~& ]8 q9 M
说的太对了,赞同的赞同!!1 b: `. O$ W7 l' R* \* z1 M* f
Ragnarok power leveling
: L( x$ S$ F% v9 z  w6 x6 f$ R" Yro power leveling2 N- o! N0 p+ y% f6 G$ p9 d& D" E3 H
Ragnarok Online power leveling" W( `) h8 A) U8 R8 n
有事者,事竟成;
! v4 L7 b* U/ y) y! p: Q3 ?4 }1 v破釜沉舟,百二秦关终归楚;
7 h2 R! F  ^5 H* Q( M7 W8 y- [& b苦心人,天不负;9 w; r( A; k; i3 B( h; C
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
5 a' Y6 `/ J3 k. a0 o/ E1 P7 y3 `; r7 `: ^) O
0 B' M- G4 U) `6 X
8 d' N* }9 z) |' \

! ^8 q# \) L$ o0 I7 `' B" J& C, t1 C9 C2 s5 l
8 ^) B4 f" Y7 J5 Q$ G
  C% c5 Y2 r1 n5 Q5 @! g1 d

1 t6 U0 u/ t) A+ b7 g' e) m4 w) [" X6 ?+ P, T% I
# }( l; W& Q9 T# j# u

" Q$ N" r! |/ _' Q! k
% s+ S6 X8 \/ S! j' E7 e+ [) T9 f  r6 {7 ^7 B- P
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!8 {1 e) d8 y( Y" Z1 U5 K$ k" E

3 k8 ]" Q/ K. C7 f8 i
7 _! K9 W0 n: V4 A6 l  o0 g) x: X5 x6 `* Y: i* e; h
5 c2 Q# G) n7 D4 ^# m
0 |' y- G! l/ K. M) G5 [% v
" X) _3 }# ^: X4 a* p) p
. y2 z: J6 v1 x  l0 ~7 `

  K7 l6 c1 G4 ?6 [
' m3 y$ |7 p$ Y7 ]
  Z" F( h6 ?* U& h4 G% V8 o# J( a! m$ B! j6 w
* R8 [5 h$ B! g5 }6 R0 `6 `

4 K. w4 \& S0 R& D* LA333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題