打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
. ~/ M9 D3 J& Q& P% J
' G. H$ ]& p  |- ^+ F: ~6 @http://pic.segaa.net/segaa
/ t% J/ y# g7 p* o+ H" K! R; K2 F" E+ _* P( ]$ [
自動相通於( ?9 s' s  @9 G7 A% x
2 U7 W& \2 b" F' n; g: @( n) i
http://pic.segaa.net/index.php?cat=10002
1 {; o  h0 B. J
: t$ O8 K( i4 R9 K/ \6 H讓使用者簡單的記住自己相簿的網址
; Y# @% T; y% d1 n
8 X6 ]$ A+ c0 i: C) Q* o編輯index.php 加入以下這些& O7 L$ u8 A) J5 C
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

進階的精簡網址 ... 基本上直接開啟外掛就好了 / c% b9 x3 D1 e9 q9 m2 `6 Z* k
& q3 B. d: Q; c9 c( }# b

6 Y( B' S& z  f5 K1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
+ M7 h& i( R3 p. |6 p, L- y& R
7 [, ]) u( [; p5 K9 v, M' N2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去+ g: ?3 K: ^1 v6 Z" c
    選擇覆蓋掉原本的 .htaccess 檔 # G/ Z" x3 D5 b  ?4 g% T" c, @$ w
1 x) R2 [: k% y7 }0 S6 a6 W# N
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
" }6 v  L& V8 S: C, m* E; c; j7 o8 U* Y+ Q2 O/ L. E8 X5 m) P
下面是我目前的 .htaccess 檔 4 Z0 ]- M) E% c9 p& d' G# Y& a9 @3 ~8 ]5 F
& x2 Q, g" _8 Y- |4 |# w1 k2 M2 K
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

其實關於精簡網址
0 e) [  l* q& h+ s& B% }% K這邊站長的教學寫的很清楚了
# w, |9 I  e/ h1 T: r+ j謝謝
( G% K. ]9 w' l( M- j, q4 ?# [. v2 A) ^' B. C, Y( p0 H+ Z. J
但是我照做之後
  I, _6 |7 ~" W' ^. |6 O: R. D) _( t, [不能連入相簿了
: p+ }% K3 d3 b/ `$ g他告訴我這行有誤
+ i6 q- Z' c# d6 u. r$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
; d( k5 c8 Z6 ?. X9 ?, p(上面的cpg134_users我改成cpg1410_users)8 j+ d* _, ?0 t6 L, n

# e7 C4 x4 o# K; z6 N8 Q請問一下我該如何解決?
/ ^% k0 Y0 a$ j# g$ c& m, r謝謝

TOP

sorry 太少上論壇看東西了 7 Z2 Y: N. b) T% z& _- r  a" b
這邊原本是我用來丟些文件用的 * \& n( l- s; b0 B2 t" G& m
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
9 U  c6 B9 A; [, }+ R, F% J- U- q" S, i( w

+ m& D$ V6 c% [
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
) Q$ |: r, z; i( {* g: U; L9 S1 u其實關於精簡網址
6 S6 L. c" l  x6 Z1 N) O這邊站長的教學寫的很清楚了
1 k! Y5 [- f- j3 `: u, \8 p6 E+ B謝謝
2 b* m; v- w% I/ l2 G  j' }0 e0 X* A5 q2 M
但是我照做之後
, o! c( Z9 v* A不能連入相簿了! u9 t, m6 l3 Z  B( S) r  N
他告訴我這行有誤  O* u; t+ n1 t5 o5 E' L
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


! K* A8 L0 u7 k* Y, i9 i说的太对了,赞同的赞同!!
8 e  P' A5 p+ O* C. dRagnarok power leveling0 x3 U: m' V; [4 S$ _" g5 `! ]; ^8 f
ro power leveling( m( T9 ~; ~. w% G* \8 q- b  S' c$ J
Ragnarok Online power leveling
5 p9 E% u& I1 U7 {有事者,事竟成;; x- b; c8 E1 h; L
破釜沉舟,百二秦关终归楚;
! R  U8 ~) Z9 A9 e& e: g苦心人,天不负;
/ z4 H  Q& `  _/ A% j卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!6 l9 @9 R5 C* `- |! |' U& Z

; b8 F' V3 ~. a; ~' h( E0 f
% z+ @$ X/ x4 V! o' g4 A# S- l4 A! m& T4 }) ^: y! C/ h* g

3 `3 C( Q* \" t! k0 J5 p* \
' Q7 i  V8 a  L: u& _8 I- x$ A: g. v5 l0 q2 C) y4 ]

# W# L, ^1 h2 _+ Y4 q$ f8 W9 F5 u/ i5 `
# x" h% V' X/ E' U" l( I5 o. M$ B% b; m/ ^4 ]3 D. @9 S+ ]7 ]# V. ~

8 w$ T0 \% r7 I  |0 Q6 z- [  e' }) S
7 D* v! r+ N* f' ], j/ y  [  u* y; v! R# O+ A- o0 g  j8 e
" D, n+ s. t$ D/ O1 i& p% O" o
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
' H) T4 W: Y  z. {4 N* o( s8 _8 L$ c. S0 l4 `, |6 [8 D
/ `8 g' }$ \- q7 Q1 E- E% g& i4 k
! T* D2 D6 g9 i5 U! E" _1 o

- s, z5 y, m# A- y6 b1 U6 F6 F
2 @5 O4 G0 u+ V8 C6 r+ \+ W
, l" N# l1 Q1 C( S
! K! _1 [$ N  O' q, m  |/ D5 }5 l7 f) v7 o

0 ]  O# S" q+ b" x* I/ n: j  J( ~5 _

  X0 e) c( ?7 j/ p  d( J; i
/ t; d0 t/ \4 L: B2 V  H6 k
* ?& q5 e8 {+ ?- W' V1 cA333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題