打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓- B9 ?: ^1 F) R
  I7 h  Q2 t  f4 h: }3 d+ k3 m0 i
http://pic.segaa.net/segaa
& {' o; K1 ~. [: [: E- `- x
$ i0 _, l6 f8 h! d4 ]自動相通於
9 w. G5 P& z0 H
1 m" l5 Y% z3 G2 T  T  Zhttp://pic.segaa.net/index.php?cat=10002
6 K$ e( G# N4 Q; P" E2 z* I9 P' L' W9 n% H2 C/ `
讓使用者簡單的記住自己相簿的網址
% C! Z, f% I+ l1 u1 c1 p' o' e4 A, X7 R" x7 F6 [; O
編輯index.php 加入以下這些% _. _0 C! D$ {: X7 r
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

進階的精簡網址 ... 基本上直接開啟外掛就好了
' o* s0 j  L9 v/ z" u% U* H4 Z" ^# {6 s" r, Y: U0 \6 W
$ a: y& g/ ]8 k  G% J& Y4 l" J
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
6 Y% S2 q3 [0 c
  p" Z+ K- x0 H  Z/ S2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去( c4 m3 X5 g" j3 ]( h
    選擇覆蓋掉原本的 .htaccess 檔
1 a9 s$ l* U1 a6 q! i4 V- q9 i( {' V+ \) q* v/ K
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
. Y7 J8 d6 Z3 ?2 ]2 ^$ a  x6 F% c; C; i$ o
下面是我目前的 .htaccess 檔
4 _. Q' R8 `8 F5 D9 P0 }- b
* q. L+ m' z0 D4 V2 ]$ [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

其實關於精簡網址% ^! ?# R0 S. a$ v2 m0 j" u
這邊站長的教學寫的很清楚了
+ \& o9 H( F2 Z/ A$ j( W謝謝
) D. ]1 g2 A5 G7 W& p& a/ T
1 `2 [/ s. F: y: E% t  x但是我照做之後
, G# K  b1 X5 S6 ~+ e9 V1 m/ o不能連入相簿了4 S$ b. e5 S# `
他告訴我這行有誤
  t& c6 T/ s5 F4 Q. c$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
! c8 ]1 t0 E) `6 R$ h' E% W0 W  h(上面的cpg134_users我改成cpg1410_users)
0 U4 {3 e" r0 q0 x9 d1 B8 ]
% j0 d% h  C9 @- ]/ k0 ?4 l請問一下我該如何解決?
7 d2 F# v8 N( \2 t' B7 c謝謝

TOP

sorry 太少上論壇看東西了
& P3 `2 D, N7 {, C這邊原本是我用來丟些文件用的
$ ?8 N8 G  f3 t5 p/ _& V3 F關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
  j& A" m( b: ?/ j; L3 o5 F- k( P
, X  j! }9 ]4 v/ R
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表! @: V4 w* D. E
其實關於精簡網址
; T* h3 W* U+ w; w這邊站長的教學寫的很清楚了
7 P7 ?( B4 i+ C( o  H* q謝謝, v+ ^; n. R1 K4 d% z3 c

+ I' C+ Z% f# U1 l但是我照做之後
& [6 G  o6 J( U不能連入相簿了
) A" T9 K* d9 z" a1 b; |他告訴我這行有誤
* Q6 J5 u+ p+ y0 \$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶
$ T) F. G* d* Q5 h( g& O说的太对了,赞同的赞同!!
# l8 m2 {$ i7 g: Z& o. C( VRagnarok power leveling
: H* J# A2 A+ M1 F7 sro power leveling$ E" d5 O$ V3 y  c
Ragnarok Online power leveling# ?/ K: P; n; l: P
有事者,事竟成;' I9 f% X5 b  g9 s$ x' Y. D3 O
破釜沉舟,百二秦关终归楚;! @" I8 c3 L0 ?, a- T6 m$ t7 F
苦心人,天不负;* }, @% f4 x) A( s. O0 }
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
* J, @$ {" H* s1 X# |; X( v* D: ^, I% m) R) J

: @1 l/ f2 K9 [$ j: ?" k( w/ f4 y) Q, D* Z

3 T( G, s; g  H" D8 g" x
- |5 p6 _* I4 @! o
" P8 Y+ \9 m+ j, _6 z
! Z  N3 g* i% v. P  C7 s; u: f$ z# y; {
+ f4 O3 W: m. i) H) q. Y
2 x' C* ]! G# @: Q& t7 T

, V9 ~! v8 ~, D* E% s4 A
8 O+ C9 X% ?; U" j0 G) `/ y0 k' M
1 Y' h, C& i% h高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!  h! Y5 \. P9 y. w4 R" N2 r- X

. K" z3 J2 l0 Y0 C7 h: `3 ~+ |/ p! L4 ], I$ i0 Q
. b! g( t9 Z$ J  V7 I% }
$ p- R& ]. x$ d* X

  H/ L3 x4 q$ @  C! ]5 X6 c' z
. {" J9 V7 i  c1 N* w/ a- @# z  f2 k2 |# j) K; _' ^" N; j+ J3 L
- C7 F% Q! M! i* r( t

3 b' a) N: l, ?) M) d5 B+ ]/ V8 |& S! y

( Z- |4 W3 P" i6 b% ?2 r3 \2 c/ R' r4 t+ l& M

. v# F7 t) q, Y3 S" D) T+ @: o* pA333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題