打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓$ K& N. w, q7 \$ |. r' c( F- O
* h! \& X/ I% z) a) m: ~) S
http://pic.segaa.net/segaa
2 W+ W% i9 b) V1 F
0 \; t  b7 M* x3 ~" Y! W自動相通於
* p8 p3 `) _4 s+ E2 r0 ?; q% g2 Z$ }( x
http://pic.segaa.net/index.php?cat=10002
" I8 Y' ?: g$ M4 W4 d- C) G, b( w# U* e$ k: p
讓使用者簡單的記住自己相簿的網址 * z4 L3 H% x9 Z) @) D
3 N  W5 f% G& W/ L# P6 h7 F5 l
編輯index.php 加入以下這些# m  G6 x) K: @! W/ A8 v1 {: 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

進階的精簡網址 ... 基本上直接開啟外掛就好了 ; k; k5 |8 v8 h5 e# m( G* w
% ?: _8 l9 ^+ q3 u

# H3 l* @! h2 O( @+ A+ h2 U& E1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 / N2 m% _0 A- g9 |' r/ h+ n/ p

/ R  z# U. i- l5 L6 P- d2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
2 D! A9 M4 U4 V0 R9 a    選擇覆蓋掉原本的 .htaccess 檔
! S8 b$ T- h! G+ J, F4 N
+ y, l, I3 m6 g+ }3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去( X, m8 x# W+ p* n3 Q9 s
* o, H9 e2 o& P5 R. C. d
下面是我目前的 .htaccess 檔
9 U# B& j( M7 O* m5 n" V1 ?: ~; \0 C7 U+ @
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

其實關於精簡網址# @+ ~* h. L. _; f. H2 g
這邊站長的教學寫的很清楚了
% }5 F/ H( e: a; o) s2 p謝謝
; b  x  @# M7 x, }, a# v
) Q7 j3 w$ [! ?# z但是我照做之後7 A5 ~. e" j  t* I, \1 `
不能連入相簿了
) Y3 Y* `# V# K他告訴我這行有誤+ U+ _8 ]7 {" A) g1 |
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
8 X0 m' I# z) Y/ e(上面的cpg134_users我改成cpg1410_users)/ k+ {% O) Q3 L, C7 B
2 l5 z9 a, p) q/ T- P2 N- ?
請問一下我該如何解決?5 J5 s+ ?9 x8 q0 z
謝謝

TOP

sorry 太少上論壇看東西了
$ g8 _. x& y- g2 n3 _這邊原本是我用來丟些文件用的 ' J5 _/ t  ?; }1 W5 i# x, F6 M
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱/ K( Q; C1 b/ R
! e8 @! m8 a) R4 T
9 I' q. {& e. J' {$ O
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
5 \6 L* `: K5 ?4 {( F6 i$ l* q9 Z其實關於精簡網址9 ~- q% u2 d) a- ]% S
這邊站長的教學寫的很清楚了
4 q9 x. X# L6 M5 h7 J0 p* H3 K謝謝& d' e/ e. z2 }; M0 C# Y! R" D
7 z4 x$ _7 A0 W; n
但是我照做之後% o0 j4 |, C  R2 U6 }
不能連入相簿了
/ [5 u# H7 x; y; O3 \3 U; F他告訴我這行有誤
+ I, \. N+ B2 E$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶( n3 [! V7 Y' c0 P0 K" @
说的太对了,赞同的赞同!!
$ {" S4 W) U# J4 t' i7 VRagnarok power leveling
" ~1 I; ?2 w! M/ M& Y. Gro power leveling
2 v/ L6 \0 X9 ^# S8 K6 rRagnarok Online power leveling
* o/ t8 t) i$ l9 V7 |3 Z6 \有事者,事竟成;
+ U# `* S3 `' O; S3 F0 i破釜沉舟,百二秦关终归楚;/ d  o9 v$ S, P* i
苦心人,天不负;
& _# k1 h& {! M7 i5 `卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
- f, z- W0 p9 \, F8 E3 L, n' V2 B6 D! a$ @+ q
% w2 ?1 k; n& p: y+ ^

( ^( @9 I% W3 w9 F! V$ B6 D
9 Y4 g& J, @3 [! c/ e/ K) ^
8 ]% D3 @9 K" V2 T( ]! `# |. E& f
5 Y& y9 _/ ^6 Q9 u% a8 E$ e+ p0 F4 b

+ W! k! c7 ?% f$ w
4 g: k6 C7 `9 e% |4 y
% V  s# n2 h5 ]4 E) t* d% Y" m7 m; I2 r. w- _6 N! T3 j

, {1 t# u, V! M+ f( ?$ j  h5 K* H! O
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!2 U- C5 E; J1 s, `

* G9 H" V5 u8 A9 G! L5 h2 W% A+ O! m- W8 k4 v$ w0 l0 `

) g+ E+ f& g" ~. j( [% C* d: m: }4 E# [1 L. Y5 G
- V1 f* ~7 ~! e) p' P: E, q

8 s4 O3 s  I+ J" G
% S% }+ g' q& n/ ]
5 Q- H+ N" S8 N2 @# Q! D: x  @
4 |! F5 G. h2 U' J, `" r) }8 ^- m% o* L" {& W8 t
6 @8 a8 a! u$ `" A
# k' S- K7 h* d$ I* r( y1 O- i0 F6 E! i+ d

! B/ Z2 R+ Y( \, uA333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題