打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓% X1 v' r* f; w+ x
& U/ g# o4 v# w% A$ O# H4 }9 i) G
http://pic.segaa.net/segaa! n+ U5 x, B% C5 k. S' w% T% A/ ]
* J. A% R4 s. t! G1 z5 E. u
自動相通於+ d+ P7 E; [, i, f9 a

# r$ M% Z( J4 ?. G  `0 `8 mhttp://pic.segaa.net/index.php?cat=10002; [* d  i7 p" U2 M: p: Y/ A. @' b4 a

  N% y0 D; }; Q0 C  n讓使用者簡單的記住自己相簿的網址 ' v2 C0 m5 W$ w- e4 P0 \: f" L
/ H4 v% Z2 g  G, y. \$ D$ h" T
編輯index.php 加入以下這些
- n, U6 x' M1 w0 C, f3 acpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了   B: o- z' M/ P' b7 S! F" A

0 v# k& K1 W; }, p
9 s8 N2 B* L+ t4 m1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
3 `9 m+ Z$ i7 J: t$ l. [& w0 I7 n' b8 ^/ b
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
  n! f2 [$ X2 P. U* j$ p7 L    選擇覆蓋掉原本的 .htaccess 檔 ) X( M$ H" A3 ^1 G9 X) N/ P3 T' _. z  V
' ]" ~, r+ [$ |  x( e/ @- o) u' e
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去# v+ l! j$ p+ O, a  L

' c+ h" p. ]8 h& ?8 y下面是我目前的 .htaccess 檔
; ~7 }5 _0 _' @9 `* q7 S6 D- H/ k5 A
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

其實關於精簡網址  q2 E, C* E! @: p5 d
這邊站長的教學寫的很清楚了4 n' X4 I+ I$ D2 M( ]4 ~! G
謝謝
- }% |# l$ a1 M1 C# B% d& |6 X# u( q, A8 O/ R- @
但是我照做之後+ h, I# o  _0 n- O
不能連入相簿了
6 l; Z0 ?: y& c( h  E, }  A7 R他告訴我這行有誤
# `+ F+ Z, q! X$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";, m9 F9 {. r2 e! u
(上面的cpg134_users我改成cpg1410_users)
4 i' m$ k0 P/ M5 u
0 h9 V6 q: _* _6 }1 K/ j" f" p請問一下我該如何解決?
2 Z+ j0 k5 K  w( ^: K0 m9 o謝謝

TOP

sorry 太少上論壇看東西了
$ F) \3 m, d+ T' h$ d. e! I3 ?這邊原本是我用來丟些文件用的 # T1 u3 L& R+ I- j1 ~8 A; W
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱+ O$ a4 b! X4 Y% s  [) `
1 |# u" ~  @6 _: H. Y9 g4 M$ l
0 p- u8 I; S  a2 S7 _, O' G6 q. I9 Q) `, \
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
# g( ?. E' _$ P# o其實關於精簡網址. O' [" G: m1 M4 {' N2 ?7 C3 p6 t
這邊站長的教學寫的很清楚了' u' V; j: `3 G5 B  z
謝謝
1 B9 e( f  X7 l6 b# x+ g1 Y
0 Z5 x1 a2 s; h/ g. y) M, g% ^/ A但是我照做之後
7 h/ ~' X0 B& n! _+ P0 ?, m$ L不能連入相簿了
! J' t" f, n$ c  m( ]3 m他告訴我這行有誤
: h) T% X' l- O9 [! F$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

* ~9 O2 p- f$ t! q7 [. m9 W: t" S
说的太对了,赞同的赞同!!
: h5 ^4 O; U2 J, D! jRagnarok power leveling
1 e* Q3 C" d3 ^6 p7 Cro power leveling
7 g# ^+ v" x3 r  k3 WRagnarok Online power leveling% I. P' i  g5 j9 v* j
有事者,事竟成;
/ E9 H, i. q; G0 l+ r# d% B" q" n4 G破釜沉舟,百二秦关终归楚;8 O' ?+ L' `4 c! p$ j+ Y. x
苦心人,天不负;
% G. j( I( v- w9 }卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
  m) s1 M* h/ C0 m& s: \
7 K: E. D6 Y7 N
% j- r) C" }! ^: g! c. p7 j3 z+ K0 a( o  A3 r8 |6 K' O
" Z( ^8 [3 u9 n+ S! L& x
& O/ D: l, v( \4 y7 m( O

  e0 |! n+ ~, X3 p/ }8 C. V; }* N$ L$ j' C
! f  u5 C% i& S5 E' X! ~: g+ Q
4 t, ?, i# Z  F8 k8 ~& k
8 Y" N% U( Z) A0 c0 O4 n- A
9 [6 I6 j. r* j1 A" I" M
9 ^; m) P; a1 e% U0 h

* X# K& V" f9 H+ x3 f8 C高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
* w0 m  ]. d. _; I2 E8 V! `
0 ], m) v5 J; r4 Y# i! k' h  v4 j! b5 Z$ N' t! c+ q9 C8 ?' G5 t  H( ~
5 a+ }) \( r  ?7 M

  C: Q. }, ?( ~. @: b+ x6 K: b. z( S4 J. u5 D' c  g
! H" O. Q$ ^/ M# ~; K+ e

# a. x/ H5 _# l# i# Z/ S0 [6 _" a' Y

% R+ J1 f; k" \6 O4 y+ a* Z
, l/ @/ O3 a( ?7 m; ~' ^+ s1 u3 }+ `( H1 [

  L8 ~, e# h) F/ @: t5 y! q' W
3 _! w4 Q! _' T& d- h, Q: NA333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題