打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
0 i! g7 r  ~4 Z% v9 x% a! [2 t, F# ]
http://pic.segaa.net/segaa
- |, P& Q% q+ Y/ ^( o2 J- |5 Y! M4 H7 r1 J; U. k5 [7 U
自動相通於
) E' i5 P. G6 k% c  L6 G3 r3 k" j7 l* W
http://pic.segaa.net/index.php?cat=100026 A2 Q! ^) T: [: C

9 d, g8 z/ i6 n6 D讓使用者簡單的記住自己相簿的網址 + m# K* Y0 Q/ a8 l; S
8 S/ p3 p$ J- d6 f. T8 R5 P
編輯index.php 加入以下這些
3 U; e+ c3 w6 mcpg134_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* w; T# Z& @& o6 ]
$ \7 @& L% S3 B  U+ c9 ?2 e  C' c
5 t& l2 x: M2 z+ o7 X+ |7 M1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 . R7 s% [/ `+ Q7 V9 \

4 l- i. z  s' l5 Q( J2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
( z* c! S( }/ B' \& b6 [6 k5 o    選擇覆蓋掉原本的 .htaccess 檔 ) c3 @& p, _2 c  u
8 f$ F. c' N0 c
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
' |% _) n3 e' y: K: D% n' p+ F# D+ P8 y
下面是我目前的 .htaccess 檔 , s) F! `, o; N& P8 X6 Q$ |& d
7 C- m- `' x& d
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

其實關於精簡網址  o% @! j3 r# B& p# y& H
這邊站長的教學寫的很清楚了$ R0 Y  l- y" `; A/ `# Z9 u1 k1 a/ r% K
謝謝
( e9 [+ w2 L& D( N. T1 T9 u  c* M
" N. X( Y4 T% ?7 [7 S' \" [但是我照做之後
  c( G! Y1 o/ {" p$ p) v0 T不能連入相簿了
# L' M2 x2 |; g他告訴我這行有誤6 r' X& R1 K' c; t+ D* M
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
! L$ g8 F. @+ t$ G. F; i8 ]  R; q(上面的cpg134_users我改成cpg1410_users)0 L; Y2 Y) c" O

. ]$ ?, v* K2 |& r8 w請問一下我該如何解決?
+ V/ Y' M2 I8 F3 Y' Z' x謝謝

TOP

sorry 太少上論壇看東西了
' y: z) c7 n( U0 u# ~7 H這邊原本是我用來丟些文件用的
, n: l- _( R, r) A# a+ x/ [$ E8 x關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱& b8 w6 l, r4 g3 i

$ l1 d5 A! \/ v! e) @
  \1 t8 S8 C2 {. S3 u
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
% [& h; i0 g) c其實關於精簡網址2 O* G% d4 T& f# d, B. o' G0 F
這邊站長的教學寫的很清楚了4 u  r3 z& z. X! |! M
謝謝8 e5 g4 o& y0 A3 `2 @
5 V3 Y4 x- B: @. u; B
但是我照做之後
; l# V5 D! W' t- q; _不能連入相簿了( J" p: M, W$ k, N
他告訴我這行有誤
, L* t! f$ |- m1 b( W$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶
3 B. h8 m3 g( D说的太对了,赞同的赞同!!0 |( L! w) v( F  f" e: D0 T8 }8 o# A
Ragnarok power leveling2 P# q  z7 L+ d/ M9 ~* M0 T- a7 j
ro power leveling: H9 C2 y5 d+ q6 `; p
Ragnarok Online power leveling# Y4 l0 z" o7 C% _. C! C+ M5 z
有事者,事竟成;9 ?- V. V& i# Q" o
破釜沉舟,百二秦关终归楚;
+ B# d# T$ M- g苦心人,天不负;
' o' ^0 E1 V) Q7 n2 }6 w卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!5 X7 _4 L* q: V* ^) G7 O' k, G$ F
: `+ x! [2 j% U

0 d1 @" T5 y! v% |0 v; T' S7 R2 w  V) O/ B5 t9 X% O

# r% a' g! E8 }- {9 w4 r6 A: A7 N! {6 c! g5 i

8 G4 u' e( N9 ^# N4 T
, w$ d2 G; b% r5 [
5 P! x+ R+ R# d( D
7 @% t' C/ ^" r( c6 |
' e2 ?/ U* ~1 F% y+ k, i0 x4 T8 ]) B1 r2 \8 e2 P0 r
7 V+ }" T  w5 U0 K% O
& J% i1 }* ^5 A5 t! r
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
6 x/ `# h& f+ Z1 g1 R2 ^& g! w# {# |2 ~4 n

+ D/ E- Y: _+ B) j4 v; z$ C8 Q9 r2 P
+ f6 |6 `) m4 f7 K) Y' H! L8 l9 q) c+ e( Z. O

9 d  a; L2 Z* v
: j+ a  K! x3 J. s5 A) ]/ U) }1 q7 C$ r1 r# Z( u- _1 U2 u5 J

, v& N7 [0 O" m+ @& d3 J( Q
  c% J/ [" }* R; W- L  S; g
  Y2 `; K% a  S& G# C6 C) M( m5 v
; D1 S" J5 u8 s3 T' n, ]* L7 s! t! U6 v& |4 P+ d
  e: j) h/ i, ~: j# K2 h. l3 r5 W$ l
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題