打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓, e# D# e+ \% y0 v
& r+ Q! F" U& l( u$ M5 U
http://pic.segaa.net/segaa$ D5 x7 v6 u6 \$ I9 e' c/ O: H
8 @7 z. d, E6 a, `  v! ]  [
自動相通於5 ]( v7 G; L: a- `/ C& |# W5 d
, h' T, v# c: E: o
http://pic.segaa.net/index.php?cat=10002
. o: P! U: W* b! s0 p4 v5 M. t) D" @* J# ?- q+ A
讓使用者簡單的記住自己相簿的網址
* a( ~8 f) B2 g3 q5 \" `- ?; J- e, a
編輯index.php 加入以下這些
# p0 u% n- [7 Y  {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

進階的精簡網址 ... 基本上直接開啟外掛就好了 # T  ?( G* ?3 l4 A+ z6 g
# N. t0 }% ^* S: }! n, a: M( ?, I- T

- W5 [$ F" X0 m) j0 N1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
4 D$ f( B7 z8 L: }9 P* J
8 a' ?, P% {3 S0 _! T# f% B' ?8 y2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去% y& I9 H6 j0 E' I4 I( Y6 B
    選擇覆蓋掉原本的 .htaccess 檔
2 _( I3 I9 R, N# z9 V4 ?/ W4 w5 i# G# n$ g* ~; i$ W" c8 |
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
" C/ y; v; Y% h& S- q3 A( a
5 w( R! o  H8 T* L7 X- X下面是我目前的 .htaccess 檔
. j7 l. g6 W/ U# t* j" d  D2 t/ _+ \% }, v2 m  m$ B  Y# B' R( I4 K
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

其實關於精簡網址9 t% _. O& p+ d2 U6 i  K7 ~
這邊站長的教學寫的很清楚了
( A4 z/ q" O$ n1 G謝謝* i/ X6 S* m& o6 b

# Q! `& x" Y( H% g% w0 ~但是我照做之後, O# H3 k% i: [, _2 i1 U
不能連入相簿了9 x# ^, v: L- z' v  c
他告訴我這行有誤9 k& z9 G- \+ b
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
& b: F: g/ s( C(上面的cpg134_users我改成cpg1410_users)
( y, d* F& d: H! G' n2 L# b
! S/ P" f% i( v- ~: [請問一下我該如何解決?
6 d- ?5 Q0 d. m' j謝謝

TOP

sorry 太少上論壇看東西了 ' {6 o5 A" c- F: d$ \8 M
這邊原本是我用來丟些文件用的
3 t" w! @, I6 Y; {/ H0 b關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱) O7 J9 D/ A7 F2 G! W* F- ^* E1 I! {

- ~* m. a+ J* e/ f8 m6 s) A/ a8 B& x0 G' T6 a7 x; L
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
0 U/ o/ r  j- u5 @6 Q其實關於精簡網址
" F( L5 J% Q$ @+ [3 `這邊站長的教學寫的很清楚了
0 ^' r  G: S  h% V謝謝
4 Y- O* ]4 u, ?7 s  D$ i8 U) I' ~! {# C5 B+ {) q
但是我照做之後
% H% s8 B( v. o. p$ d不能連入相簿了! V3 \; N& A5 v7 s# P
他告訴我這行有誤' a+ T" b( M1 @) i
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

% D6 f) F% ?7 O9 e: s
说的太对了,赞同的赞同!!
3 l& A' j* ^/ W: _7 E- v2 _Ragnarok power leveling
; N- ]& a/ D( G# S: G4 Q( qro power leveling
2 n- C, V- a6 m  d, |: fRagnarok Online power leveling
: T7 l9 k3 q/ p" Z有事者,事竟成;
2 p7 N0 B* i! {- x( T, Q破釜沉舟,百二秦关终归楚;  t; ?: U8 g- \, }
苦心人,天不负;
/ h3 j7 A) ?/ [5 k) w& y; X卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
" z. H" {  N" i* I, n* l
* [. V. P/ D3 Y# X
# w+ r2 Q# Q7 @% F! F, l2 C; v9 Y' f0 [# H7 D& `0 c9 F

8 M) j1 m0 v' x1 d" n9 o3 C2 I, Z6 [# O; ?$ N- z9 y

, N) T! H& ]0 c
2 \1 D! G  o1 _: G( S
8 t3 L9 U5 Q5 D. x% M0 v3 G* x6 i2 L! N" ^
% U5 p. x6 [, H: t2 h: Q

% k/ R5 t& f/ k& T# R- ?( e/ s2 ?
7 N4 K6 R: F6 s* L5 d5 O
4 a# O- f: g9 D) o7 |高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
' ~/ E7 Y8 ?5 u, R! x2 @! h, [5 ]) h% Y

3 N( h) Y* B* L4 e( J5 `3 M# F. u* l& A

( S# {! g5 K5 @" o
7 t4 I# G0 A# a5 R4 {& K) [
* ~, p& H' N4 m- \( A* ~! d$ i9 n& u' A% [: ~8 w+ Z$ Y+ Q' z

. ?, x4 A) ]( p1 Y9 M4 q9 ~3 b2 L8 l8 ]* U8 M5 S
) u* n8 j8 r( k2 f8 \" v2 P
; G. `& N* P' b2 U

7 R1 e* }" w0 f! Q4 M
# k* C) g& d* J- T# C3 l. H1 {A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題