打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓9 Q3 E( @( u$ j, V! M* O6 D  s

0 ?6 S: J/ {. ^& F8 `: |1 R) n0 p, @http://pic.segaa.net/segaa
) k% T, }8 g, T; r* Y# W4 [4 K8 S+ h( Y/ Y
自動相通於; x7 Y# D( T/ p; Q# [9 x
) w: P  h/ Q* E2 g% V& u
http://pic.segaa.net/index.php?cat=100029 D/ A- H4 Q4 Y7 n
/ D& f4 p: w+ X, l, S
讓使用者簡單的記住自己相簿的網址 9 d! m* j# R/ `1 w2 b; x

8 ?0 C6 _. n+ R/ r編輯index.php 加入以下這些
% ]+ j7 t# ~: f/ T; t: l  {* _5 @3 Ncpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了 & {6 b5 ]# Y  G( {( y, N* S% Q
/ \7 k  M$ V& h# _6 B' R! N
! T) j1 I) u7 E; V6 ]) \  e" N
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
5 c% l) T, g& l6 v
! Z7 T0 W0 _. R3 A2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去" L1 N1 r+ e; U% R" j
    選擇覆蓋掉原本的 .htaccess 檔 + X2 c$ M, U0 i% e% o
* o5 r# l1 p* l4 z" [
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去/ q* R9 h. ^# i3 `
5 @( k" `: U4 `: }: O, |' a
下面是我目前的 .htaccess 檔
% b2 `5 e4 l: p& v
( E! ~; n* q; \' g, k! Gps.我將 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

其實關於精簡網址
# w3 S; b0 h1 Y9 A. P) \這邊站長的教學寫的很清楚了
9 k9 _" W2 W- h4 p& i1 t/ B謝謝
2 ?  U. f/ p! g% P
1 E6 {6 M% P/ s0 o但是我照做之後6 m1 e, O8 r7 p  F/ ?) C7 Z
不能連入相簿了
+ j3 S! j3 v6 @$ j8 x9 r# V他告訴我這行有誤
6 \, U4 t" L) a+ m2 M( z$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";5 J8 c1 M/ b/ |6 t' a- i; f
(上面的cpg134_users我改成cpg1410_users); W1 z8 _& u/ D7 a$ t6 p

- h0 d: x5 u2 T5 O0 Z" Y請問一下我該如何解決?  ~. Y6 E$ B4 K$ n0 s5 N
謝謝

TOP

sorry 太少上論壇看東西了
1 K8 {4 S( r& `- _( y7 L- i7 H這邊原本是我用來丟些文件用的 ( \7 s6 n. a4 y" J: t" u- L* X
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱' ?2 C8 j- f6 L" _
# f. `( J/ G5 {* V9 X

7 Y# g- K, P( f% Q: L
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表" R5 E* D' M( l  C  D
其實關於精簡網址
9 ]4 l. u1 i# i這邊站長的教學寫的很清楚了+ w4 C/ l# @. M! h. \' @
謝謝1 c& V& i2 ^& c1 {/ O6 A
% \7 w# o- P5 ?+ I' b; O* I
但是我照做之後
3 e+ r. H" x% d4 F) _不能連入相簿了
8 X9 k1 x6 C1 U他告訴我這行有誤9 r8 P. w* c. R- D3 g+ |
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


! v8 o# r" l0 g: E3 \; R) Z0 d说的太对了,赞同的赞同!!- J  l9 y0 @  A
Ragnarok power leveling
9 A. V. n% M3 F, f2 }3 X4 Fro power leveling- L3 s2 s- @8 S/ V2 o/ C
Ragnarok Online power leveling
  n' a7 ~9 Y7 m6 G- w/ M2 \. i3 U有事者,事竟成;# w9 u% n% c  t
破釜沉舟,百二秦关终归楚;
# L! O: P0 g4 v% H- I苦心人,天不负;  n" i: C: A$ z& W  D
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
* x, a% {: v3 D& b# G
! G; j. K, Q2 X0 F( a( G: A  v6 T& C9 ~4 o! p4 N# n* k: P) a; w6 c
0 M" A, J8 S" ]/ c

3 @' t  s" n+ U# Q- V& i2 K3 ?
# Z, y( Z# ^7 d, n* G0 b" l# s) R( a

' |! L( u9 \; ~; V' p
. g" d6 Y  |) i0 Z% ^0 v
( S4 |. B: V0 _# m0 f* ^
+ [/ }/ X- m- c, [% n: ?' K6 A6 V5 A
, e) J. O2 X8 p- l% F
1 N- ^% T# F4 j' v% }( L* M
7 s3 x4 b% g* Y3 j% V' V' ]/ U高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
5 Q! \4 b! H. k0 T# T: X0 K
/ [9 c% l0 U1 ]6 L* C
: ^) J4 o" p! I' Q/ F' r
( z8 a6 A- _" ^: i5 B3 d4 z
: K7 Y/ d1 x, H+ _/ Y3 [7 R' v- ]; e) u
: a" S$ {: W9 ~  b9 ~* F
9 x( ~3 {6 Y* O5 L8 O5 J

# q! f& F% h$ M/ Q2 p6 }8 G& j( y  E8 M2 H" A0 n: G. U  e* g1 g9 S/ T9 I

  `2 s6 I. I; L+ K" ]) M* i  ?4 [$ r4 F

4 q+ w* ^+ U) @0 A- R- O5 V1 b1 e, K
& K+ ~. Q( N) K  k* D8 P7 CA333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題