打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
( \! u, M$ [5 A8 `& @) F- k  o6 g  t- M4 B; _: M
http://pic.segaa.net/segaa" ?* W, ~& i) V

1 E) G+ Q- i- l自動相通於  i! t: Z" B. p* o- h: E

+ ~5 J0 v; q) ]1 Lhttp://pic.segaa.net/index.php?cat=10002
* i4 |- k. @" }4 L5 W( _. r9 g; |' V+ O+ u/ \( h4 t
讓使用者簡單的記住自己相簿的網址 9 B. r  M" A4 W
, W2 U, K  `/ q: M- c
編輯index.php 加入以下這些2 a" U$ L2 |/ d. p& d
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

進階的精簡網址 ... 基本上直接開啟外掛就好了
. b4 w, P9 l4 L$ j1 l1 U( e/ a- s' q6 S" f+ @2 K, I

! \( f1 N( b3 L1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認   p" B2 n2 w( w3 }& v

  l: f2 W& z# k) I2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去$ s* |; K! B7 @3 x, L0 p; O
    選擇覆蓋掉原本的 .htaccess 檔
: k6 A/ R7 ?  g: `4 V5 b. P9 M" x1 f6 r! ^2 K& [# O2 L8 O; ^8 C
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
, P5 ~7 w- c' P% q6 o, t0 `3 _
' G' w! ]* T$ _& G& Y下面是我目前的 .htaccess 檔 / T. U. ~! M7 @3 f% O

, o7 s# m6 W3 b% @( Gps.我將 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

其實關於精簡網址: c7 Z; x/ w% A  ], E5 s3 ^  j
這邊站長的教學寫的很清楚了
* \) q2 {0 q6 Z8 U# S+ v: m+ ?: S/ d4 G謝謝/ R) ?3 O. s# A+ p4 X0 z
7 \* L9 [' x/ }9 o/ w
但是我照做之後
: Y! F0 {+ W+ \5 Z  e% l不能連入相簿了
& Y3 j' X7 n* r" S9 \# T他告訴我這行有誤1 ?  c$ H2 S" N1 F/ |
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";! Q: W/ F2 _) v5 m) ~4 |
(上面的cpg134_users我改成cpg1410_users)  p  W! u- Q2 t8 `$ [

' v5 T. _+ i7 w" p請問一下我該如何解決?) G7 r3 k, _3 E. z! j7 I$ j, M: k
謝謝

TOP

sorry 太少上論壇看東西了 3 f" o, I4 D3 L4 ]
這邊原本是我用來丟些文件用的 ) O8 L7 G  j8 R) U. t2 k8 h! C
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
7 m) S% \  g0 b+ W& X+ j( H% a8 a6 N( L; t

7 E- c& J; N5 E# \7 w5 t$ y! N( [& r& i
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
% H( s  T8 F3 k- y1 v其實關於精簡網址
1 i0 W  P0 o! K, l3 y這邊站長的教學寫的很清楚了
/ V) K. R, L% f謝謝
4 R! T; B% \# j* A) O$ V' g, D- O/ @1 y
但是我照做之後
2 f. i0 F9 z- G. Y+ Z( `5 a不能連入相簿了
3 P# k! G5 j, u* \; ?! g他告訴我這行有誤
" s$ M1 f; ]( F$ v2 C( ^8 x( N* y$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

" P" p. A# e1 o3 [1 v8 C8 O4 e  c5 Z
说的太对了,赞同的赞同!!
2 Y3 R' C9 r0 y8 N3 DRagnarok power leveling
9 k) F  o0 B& @, o2 e& wro power leveling
1 T* \6 B5 u9 Y. q/ r; @/ i5 H6 YRagnarok Online power leveling  r" c, T, j+ O& v
有事者,事竟成;
: a( n5 W% J' R  y2 b. [; `破釜沉舟,百二秦关终归楚;9 n4 a; b( H# Z6 V- ]
苦心人,天不负;
, S! C3 Z. I- d6 A' w+ r) |卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
6 i; o& K" t6 S2 ^4 }8 [4 V
: V' O  H% P5 Q; X% \7 W2 {8 D( C9 o6 d3 G7 V& M0 d

3 y, _3 }6 q# Q
/ m) U" r2 j: l6 C" y) n0 q3 c4 G5 E5 Z: V$ \# F" q

2 V, d- \# d* @0 Q# {8 T* x& J& H8 ~5 {( \% ^
2 P9 l- _2 C- [: j  h3 ]( V8 N( [
4 r2 u2 L+ X1 H1 E

+ G" M: s/ {- j  K8 E3 I6 z- e" |. m5 H' O# Z9 @3 c: ~. O

/ d9 d8 ]8 i: B' G' P
! l$ R- f6 z. g" R4 b高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
1 ]! Q$ M' |$ D. B5 @& C, [) h% L
+ U9 ^( u% _) h* X" Y4 X8 u* P# q1 d

' ?3 h4 ?" s: V, q; i8 A. ]
5 L# _1 e/ @5 n2 A+ y+ O7 F- j
, i2 ?$ s3 z: O0 {( s9 H9 j
, n. a% k- `- A- {, t% ^! X8 b3 }) x, O8 f5 g0 {7 X: U8 `

# u. L$ S0 @% h5 p( `4 \! i& ^, k, k" |
6 t3 s- q! d, s/ ^

( k( I9 k" g! L' X7 w8 w! l" b! Y; p3 l3 c& z- U& Y
: i3 e" z/ o# @( G: [
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題