打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓7 K, ^0 x! |: _: g' q& Q5 E

# {" f! U) J1 {8 hhttp://pic.segaa.net/segaa1 k, e* C. ?+ D( {# O: V" I

) V% C) T5 z' @  ]自動相通於- D7 m2 M. M) C" F1 p, P' x5 ?
8 }% h* {; O$ r' \
http://pic.segaa.net/index.php?cat=10002
: T7 i( I9 `2 o6 y( a0 S+ z
; f! c6 K' @. b: X1 H% l5 N讓使用者簡單的記住自己相簿的網址
! T! E* W, @$ n; @( t+ X* \+ n/ q5 w* c2 M. E  d. y
編輯index.php 加入以下這些$ Z& J' j6 U/ U: L3 ~
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

進階的精簡網址 ... 基本上直接開啟外掛就好了 1 L( x' r5 k6 k3 s& l$ P% a
( M# r" a- ~: s; s

# G4 Y$ b& K  ~4 s1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 2 T5 ]- e9 W0 j  c* G. U

7 V  _  U- c) P) s; f2 E0 j2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去- \( Y1 x" `6 V9 }4 C7 q
    選擇覆蓋掉原本的 .htaccess 檔 5 L# N" K5 F6 O% S: T% H
' K( z* z% O: e7 F
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
0 a7 o0 P2 E- _* K2 z" X; r( Z! a* u6 {3 D, P, l% H
下面是我目前的 .htaccess 檔 - B( g- Q8 @' [  ?. ~% J
5 w/ A+ |' D, N0 D( \3 l. Z' N
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

其實關於精簡網址
5 x. ~0 h/ B; D# O6 @& F這邊站長的教學寫的很清楚了7 @) e! e2 {- x
謝謝
' t" u3 W) f# H. U
: l, a$ `4 K# L+ T$ q但是我照做之後% Z7 m0 Q5 K( B$ M# ~
不能連入相簿了
4 U4 i7 Z( l0 O) X9 z他告訴我這行有誤
$ O2 P3 a2 n% e( [& k$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";0 n& E2 B) k$ P& [% w9 f
(上面的cpg134_users我改成cpg1410_users)" k# o3 m2 @" C6 t- O! Z6 A9 P
6 X( Z2 K; V' H
請問一下我該如何解決?
* T" i+ Y: P7 f) `( A+ f謝謝

TOP

sorry 太少上論壇看東西了 # e* d( g) p( C1 _- K; J, _/ @
這邊原本是我用來丟些文件用的
  Z4 z8 v2 V9 o; X+ s4 ?( B關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱1 a- ?( v: G( I7 }5 B
4 I& ~+ ?+ k8 w% z" A: ~. G/ \
2 [6 ]. m* \5 R' c* T
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表1 A( s7 c8 @' }" j& _6 F
其實關於精簡網址' k& K/ m2 T, F: \
這邊站長的教學寫的很清楚了
# T1 q; ]" T' L0 K# M% Y& E6 c謝謝
+ K% t' _& c, b* L  {& b7 P! s- |% m; O  l. O4 P1 E" N, n
但是我照做之後5 M0 S$ {' d5 y) |
不能連入相簿了
. d, i' y/ ^# B6 F他告訴我這行有誤
8 T) s7 S+ T* \  p; _( `$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶
# n3 U" H! J7 ]5 D) n( m说的太对了,赞同的赞同!!
! k' @! h8 {- A' V% bRagnarok power leveling4 l0 w) g9 a3 _, f; d9 I
ro power leveling
1 {. _" N- k: d  c7 g' [, e+ ?& xRagnarok Online power leveling$ p7 i! D& M3 B. A
有事者,事竟成;- f; K, _. h: t2 e% y8 O
破釜沉舟,百二秦关终归楚;& Y2 v; O4 o4 ?) I
苦心人,天不负;
" \2 m3 c% h) q: E卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
3 a0 s2 H( s4 o2 V3 G
5 ], C& |" @; k& l
" b4 [1 O+ u' J9 w$ Q
: A' k, v$ u' f. @
& b2 T* Z& [, {0 `5 P
/ J6 S! l% }4 n. I! v; |& a2 g! o7 s- O

& X2 b0 o8 W& o- u6 c( a, k2 \  Z+ P- s; X' J; k* N
8 V$ N' Z: U- |' c4 X

) l" j' T' X+ J" d* M/ e5 R- j- m
  i- d7 m8 `# p' H$ I3 R: I3 `' ^  M) g- P, r+ Q9 Y+ a) [! p8 m

1 ?7 `: W' m2 b; S高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
! n9 c! ^7 i6 O1 r+ a
" I" ?6 E" O6 _+ g% I
( m' M. o1 g- {: q) O# n4 s3 I# o9 ~9 E
% F% ~% u+ M% X0 ?
7 g: l5 i. |5 I+ `
; M& D4 w# Z8 Q3 c  N# d$ e' v

3 w, n* M$ H% R. J1 P, ~0 G
) d3 n+ n- t) g2 x4 o! b
' I& T$ w6 S! P3 x* b1 @
3 f2 Z# N' s- A4 N7 i. K2 G1 W! h- R9 R6 z" g; C1 z# [4 ~& L

, y1 N' k9 W) T* o4 p$ m* F, N0 H! A" p8 ?! O
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題