打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓  x: S& W) c* b; h

! ^7 ^- n  t7 [; g0 U/ ?& t) |http://pic.segaa.net/segaa# P/ W* T- A% K4 l; O7 }- u8 `: k
8 y2 Q; t5 C& p5 w  y6 Z
自動相通於1 h3 h1 ?2 q/ j+ u! a2 L' `3 D1 t
! `3 h( B7 v: w. w1 E  D2 z0 c
http://pic.segaa.net/index.php?cat=10002
/ M, Y! ]" w! Q9 I
# O. G/ z! W% k  ~& J* ]6 I讓使用者簡單的記住自己相簿的網址 ; S- U% u; v1 \* d  T& X; H

$ d% l1 K0 j! G9 c編輯index.php 加入以下這些
5 a( e& h; @, l2 @4 E6 ]5 wcpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了 ) T9 a+ z! ^9 h' e: }

' {4 g5 l( Q+ ~' u8 Z. y3 g9 P9 C, m- c
& L+ s" d- f2 t1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
" y" q3 L! `5 g$ Z7 z* Z
- ]3 ]  q7 V1 n$ k9 n2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
. i6 [1 C. j* T    選擇覆蓋掉原本的 .htaccess 檔
* L0 A  u6 D9 k2 I$ P* V. D0 |3 i; s4 r
/ T8 x: ]. C( P/ Z! x& a4 ]1 u3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去5 |5 y( R3 Y% t# i9 ^$ f) `

7 P, Q) \1 t) A6 p! |; W下面是我目前的 .htaccess 檔 : L) O7 z7 b9 K" t. q
; f- v9 L8 ~- ~, c* X/ p. Q
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

其實關於精簡網址' ?: q" I0 {0 r0 C# F$ u
這邊站長的教學寫的很清楚了
: `. d: i+ I8 ^# |謝謝" F- t9 K8 n6 M! F
& l/ U* a- d' [0 K& L& ?2 b
但是我照做之後
+ D3 I, f5 ]) ?6 m; V  s+ H不能連入相簿了. H9 _) j9 D1 _
他告訴我這行有誤
" u' R0 ?  n# x, I$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";3 f" T/ O4 L2 p: a0 E* v
(上面的cpg134_users我改成cpg1410_users)
; O/ c7 P1 g: v* o+ H
* T( a, _; z6 N, ?7 s" {請問一下我該如何解決?. e$ i1 f5 f/ u: u
謝謝

TOP

sorry 太少上論壇看東西了 6 X% ]& N' ]4 s
這邊原本是我用來丟些文件用的 8 ^/ H6 q% K0 `  J; x, I# v4 S) [
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱: N8 {; w6 O) }0 C/ t- t* Y

# |2 q& w* {# J. D5 r" Z# }* {9 }# L: B6 b  q
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表' F" v/ d8 A: R/ m- X& p
其實關於精簡網址
8 E( z! r2 H( J3 M7 W% w這邊站長的教學寫的很清楚了; i- G# L) G4 E
謝謝0 W2 Z$ s' l# C* _

: ?- S3 z* E- ]% T但是我照做之後
1 s, _8 U& z- z, S不能連入相簿了
! h% g! x$ N* ^% t7 I2 Y* e他告訴我這行有誤
$ q$ G& n  |. {$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


# F5 ]) Q% E! F* V! w说的太对了,赞同的赞同!!# A: b) X6 b' c+ i7 u) d$ ]; T# b
Ragnarok power leveling6 J: ]( m7 S- a
ro power leveling( r8 x' ~8 G$ U  d! R/ |% H3 v% b$ ~
Ragnarok Online power leveling
4 x' `' N  Z( i8 o有事者,事竟成;
: P2 B" O+ n8 h  z0 B+ A0 i$ \破釜沉舟,百二秦关终归楚;6 J. t6 ]7 K( p4 A5 t  W
苦心人,天不负;# b7 X) I( ~7 e
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!2 ]: f7 `0 @+ _" a# Y0 m

0 K5 f. p6 F6 J6 l% ]* n# J* [# p3 t% S

( s/ |2 b& n7 L5 H+ V$ ]! U6 _( j- E) e8 G2 [" E) d8 C

. @7 S3 J; R1 s9 Y# `* j
" k& y. k5 d0 q  Y/ @
) `$ A+ ]2 s- t/ x
/ `0 L$ s3 l. m9 G' G& T1 i1 F: `9 W1 g% v  U

4 [4 N) k8 I( E- ]! [( C6 U. l8 \4 c) x( H
2 {0 \9 d* {! E  r9 s- l/ ]" j

- M9 q  j- `' k# D* D7 r# ^高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!' L! ^# e: P( o* _" [

- i2 n4 e0 a0 y" R1 a! h' z2 P" p1 `6 ~

6 ]. g& P% Q( t, k9 i; M# F1 w3 m$ U( n4 I. x1 ]' y3 d2 M6 N
1 e( m+ S; {# D( @* B, |
. x2 Z# z9 ^8 y$ n, D! \

( n. ]3 o0 J) _. F. ^
# @5 j, J8 m( L$ y  z3 V* j  _" {: l2 n6 e% K6 k$ f" r4 Z
% B. O/ l+ D2 p; n

' a* c" m5 |5 L. n# Q8 J! U0 Z" |- I4 X, }
& G% Q+ k' O0 [
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題