打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
% S- [5 t' q5 I9 i3 v+ R# ~  _( G7 a" A9 O
http://pic.segaa.net/segaa# ]9 a1 D3 b2 a4 D  e/ E# D) _
" H; E, y; J" e+ h9 m8 L
自動相通於% j1 }( z! G2 U! ?
1 i9 S  T1 f1 m6 d, ?; L: q, Q
http://pic.segaa.net/index.php?cat=10002
; `) d9 D# u. f( Z  a' K. k7 E, k+ K# C& Q1 x* Q; t5 |! C' o0 x+ u
讓使用者簡單的記住自己相簿的網址 6 B- J+ S: q- q# I5 m# W

7 ]6 y; Y, b6 f* i2 w; x編輯index.php 加入以下這些, T* A% ]. [) l8 F# N" A
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

進階的精簡網址 ... 基本上直接開啟外掛就好了 - I& ?4 \/ P5 [, z8 M

6 ]6 q0 W! H4 A2 O
) v8 H) E% u: B1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
/ f) s9 F5 a$ R  g7 u; |, h6 k5 n& _$ X) G
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去7 C- F, c7 w. U! W: J* O
    選擇覆蓋掉原本的 .htaccess 檔
# c8 @' t. O- M& n2 J/ C) t* }1 I! E" L
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去1 J" q. H! M1 V( ]
2 y2 z- V- c. b
下面是我目前的 .htaccess 檔 7 J/ u" _  N2 m; @6 Z0 Y" l" f
$ a7 {, P$ }" n- m  ~0 M" R
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

其實關於精簡網址" N8 k- T  l/ u) m) P3 V
這邊站長的教學寫的很清楚了
) _  T! n; \, E, X謝謝, @0 V0 H8 g, @# E
" ], k7 {8 K# x" ?# m! N! @( i% b; C
但是我照做之後( c' [- D8 T* L# q( d
不能連入相簿了9 e& ^" A% {* }8 g7 y- M' s
他告訴我這行有誤: ~9 C. U0 U& s) r; k
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
% V& U- e# D$ X, d: }- j(上面的cpg134_users我改成cpg1410_users)$ p: M9 ?7 D* y8 Y$ b
# E+ S+ W  b& H) l: a8 [2 Q
請問一下我該如何解決?
# C/ D9 z" P3 x謝謝

TOP

sorry 太少上論壇看東西了 ' i. d5 T" u3 f: b+ w
這邊原本是我用來丟些文件用的 ) L: l$ u2 R& F' a2 o. z7 B7 E1 M
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
/ e+ a# @6 l5 T- {/ h) C
- a4 \# o- [, j/ Q4 O  \  B  ?6 z8 g$ Z  D$ a
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
6 j% d5 d2 a( k其實關於精簡網址
( I' H3 Y( D0 S4 A, A這邊站長的教學寫的很清楚了
# u. v$ o7 z; M1 x* E謝謝
9 h" x" z$ ~5 W& P5 v4 L# N. |
* N7 w# U% U. F但是我照做之後. K9 N$ b1 G+ f. @( J7 B. C- D. h
不能連入相簿了
+ f/ @, ^" w+ @" b他告訴我這行有誤
. O+ e) C5 k9 q0 l$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

# s5 Q5 b8 `/ n3 Y) R
说的太对了,赞同的赞同!!! _3 I2 T3 G# Y1 N& R+ O* \
Ragnarok power leveling& f& d8 f! x3 d; [$ C; r( {% S
ro power leveling  W% K% b9 E- q! B6 K
Ragnarok Online power leveling. u6 H3 c3 d. U9 y
有事者,事竟成;
7 }4 U7 [% V* b. Y& R破釜沉舟,百二秦关终归楚;1 E, m8 b3 g6 W! g- e) v
苦心人,天不负;
, o- _! |, ^% U4 w% H  G卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!0 v, {# v+ b. U! M, \& r/ M, ?
/ Q! Z5 q* |7 `( A
) z" e9 f& _; d' C8 s" s
* o; L) ~/ ?0 ]% c& ^
' C* c* o) \; L7 o

: C; H6 q0 L8 \" n3 {) D4 U% N
' Z$ ?% Q' ?: B( P( R/ p+ u. t+ U  ~
1 f' b' a7 J8 }: _+ |+ D

0 C# P, {( g( j/ U: m2 K' m0 r6 E! I: l+ d1 \( ~# E

" R" o, d/ Z! C7 j. r5 j, _
' a3 J5 e" ~( b6 C: W1 J5 E% ]
+ F0 b' p: C2 t& r/ C高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
# w& i/ x) Z; W' _
0 N: q4 V4 l7 H  a3 I8 O4 k/ p+ M, K7 K4 {2 k" e: B1 E- l: f
0 `( Z6 r5 R" w* \( e% r

" U$ q' Z, t- [6 B" w4 M+ \4 ]5 o9 t( L% f; R

* w1 o9 Q8 w6 t% q2 _8 c' _/ o5 W3 ^( [+ `' J0 Z7 K
$ X& z5 l% P, ]# R: M

' ~0 [; g; [  J2 H" `! m
) L9 y: E+ K2 O3 S1 e1 V& K5 V& P% q( g- q% j
  O1 `8 T7 b! k5 g% Q
' k8 a  D2 M# P; O* i3 ~: e3 Z) Q! J
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題