打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓- {- P- g  e6 V5 P) G* X. R/ {
- p7 I2 a: m0 Y: q
http://pic.segaa.net/segaa
! d# V8 Y5 n% v& C* o
/ p; H* G) u9 P  ]& Q" U自動相通於
0 U' a( x( Z: k1 T2 _" K! Z' }4 {$ ]5 H- ]8 ~4 l
http://pic.segaa.net/index.php?cat=10002
5 U  X) a! C$ L# v( B. g! Z
* Z+ @5 k$ e: n1 t. }7 Y0 V讓使用者簡單的記住自己相簿的網址 + ?, @8 @4 H8 D' r

+ O& Q; L% X( T! r編輯index.php 加入以下這些. ^' D+ ^& z  W2 z
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

進階的精簡網址 ... 基本上直接開啟外掛就好了 8 e/ }8 @! z, a$ u0 ~6 Z
  F0 [/ n0 f3 S' s7 b, ]

# m6 B; d* ^5 C1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
/ \  g) q7 M5 R) S* I, ?4 {
2 e6 p3 a: n- G0 p" `2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去2 l* r4 r9 w+ l7 e8 W
    選擇覆蓋掉原本的 .htaccess 檔
/ i" Y0 f8 i& r0 g* C2 ~/ K7 r6 f( b0 \
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
4 U* V: z+ R2 R. T& C1 {/ T& I; U# C% w
下面是我目前的 .htaccess 檔
' Q4 Y/ R4 b. q* h
" O7 W1 c3 g+ ~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

其實關於精簡網址
' T! T) h- h' [0 P4 ^這邊站長的教學寫的很清楚了' d4 L# U  H$ j6 u# a& j& K
謝謝: Q* s% X2 `% ?/ B! C0 y
0 b; W" g9 q7 g( f0 y+ J% p% X3 k
但是我照做之後: |) I7 ]0 G' C  S. U
不能連入相簿了! m0 ], }5 u% ~! F5 |
他告訴我這行有誤
& b8 U4 D$ H& H) v$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
0 [3 A! z; F$ n+ R% K. y& m2 e(上面的cpg134_users我改成cpg1410_users)
1 d7 I$ B& t) s5 L0 n
1 M+ `2 [; H/ T- e2 e) ^請問一下我該如何解決?$ Q" j. L* _3 [/ W& N7 D( t
謝謝

TOP

sorry 太少上論壇看東西了 $ W( S3 J- b# [# j
這邊原本是我用來丟些文件用的
. u  k0 r3 G0 g: g) o$ j3 w* z關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
! c! \) q* f3 p) `# S$ I1 {7 b  ^7 H* Q; G9 J# {6 q0 b

. n3 ^2 P+ k; I) n) G
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
5 C7 U3 S  }/ w! J1 [4 o+ I0 \! _其實關於精簡網址0 |" N3 v' q# U' m3 U% t- a" k2 f8 w5 w
這邊站長的教學寫的很清楚了9 O) J# i$ e+ v9 u
謝謝
7 p! G7 b6 c! L" M4 y8 ^+ @4 r0 M. A, v8 c
但是我照做之後2 C$ _0 y  ^5 z' \, g; O$ L
不能連入相簿了$ P, X; r/ b" D
他告訴我這行有誤" V1 H: Y/ [& y3 [9 T7 j0 I, s" W
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


, E9 h- n7 t* w说的太对了,赞同的赞同!!
. a: Q7 F1 h  FRagnarok power leveling
% w9 m+ M$ B5 L7 l" t3 sro power leveling! ?$ }1 l: E$ o" J* X9 h8 }, [. k) u
Ragnarok Online power leveling# Z3 [+ L  T/ }$ B% W$ m
有事者,事竟成;" S+ R6 I6 H& F, y' W
破釜沉舟,百二秦关终归楚;
3 S& c# e( z8 E$ a. L8 r苦心人,天不负;
8 J6 w. y0 P9 J0 p! y. U卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
$ m. W1 P* N8 }$ f, V& W9 e6 i" k( q9 G
# z+ D3 {0 |7 g8 V
* Y; i0 `  k& P2 e

3 b* Z, N" @% v
$ I( S' v4 \( B7 B
4 z% O" G/ M. v
& A" V# M% D' ^( b- j* z2 d" R0 ?' W& F7 G2 K+ b
6 v) G& k1 N/ @" u6 K0 v' }* l& D$ `

: J& `3 J6 N% T" M' z, i9 S* }7 P
  _* I0 I( B. O6 u* C" I; n/ Z/ L: p* ?' t
6 X9 Z& W' l% b
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!( y$ C7 [8 H7 l, A) r

  V# a8 T6 `6 P; |( n2 E% L" g, C- w# D

, q9 P2 m9 V! G/ |  U
1 ^, V9 o4 y3 A, s* P" A
" ^8 w/ {& h; W  d: I. W/ f/ m. |9 E% Y# V
5 @: @* r3 [) k
+ j; s8 i+ d' s
: y& Z3 I2 J, U# T; K0 t

& O/ z9 B( [1 A3 Y7 h7 J+ ?% Y% v3 S% P0 R+ \6 ^0 ?& D
' Z9 E" G) ]$ V* A7 z# @7 l- D8 \4 ^
6 z* x$ O) D  J( Z5 E% i
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題