打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
) B1 x$ n; p; z4 P7 T/ N) {) G/ X. I( x. f& S
http://pic.segaa.net/segaa) ]0 a; a( m: i& X

3 h3 n" Y+ t7 E5 o, i自動相通於
. n6 d3 }% f; `, T  d( m5 }2 z( z# u: b& W+ }& m6 ?
http://pic.segaa.net/index.php?cat=10002
7 w# ?- }+ g, i2 o5 O- e* @) G
5 Q8 |5 P9 }8 j, H2 A8 u4 U: j讓使用者簡單的記住自己相簿的網址 * Q/ x' g1 i7 Y% y- o) I+ K/ k
0 r8 _# c) u+ z) `$ a
編輯index.php 加入以下這些
" U5 F1 y* A* b' w8 ?7 X1 @% f4 fcpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了 # E  h( k* }  w5 j
& i0 _/ T+ k3 o, d1 G$ E# f% i
9 U, @/ S- Q. L1 K& j& k; w
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
6 p9 p7 U# ]3 _! ?
" I& i3 N) Z( E2 L  @6 T- l2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
: z3 k1 S3 S* J8 h8 f+ }+ m    選擇覆蓋掉原本的 .htaccess 檔 9 h8 @0 V' p4 Q& W# P& v# L3 w: n
' c& m, B# Z! b* f
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去" ^0 k$ _( q  z* _* a- f( ?
' V# I' z3 N8 V& U; ~. U0 Z
下面是我目前的 .htaccess 檔
+ n, a% j) p  p% ^  d# C5 ~
+ j6 A/ |2 ~" o+ [8 ?8 |$ U4 E3 `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

其實關於精簡網址/ s# {. C$ y% h! Y
這邊站長的教學寫的很清楚了
1 ?3 q0 f6 D7 ~& T: Q6 r謝謝. J! W0 A1 J, z5 V1 _, k& ~7 D
4 P! P/ `4 l1 {) r0 g
但是我照做之後
$ f2 T; C' g" Q- J不能連入相簿了9 m& h# h0 ^$ e  F& @4 \& p2 v! m
他告訴我這行有誤' L: f% P( R1 n2 c5 U1 O3 {
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";, U! ~0 {9 c' W, L1 |- D3 E
(上面的cpg134_users我改成cpg1410_users)0 f$ ]1 K9 |% \4 m! U# g

  D/ Y6 t& f/ s- `; @3 p( F" \, _請問一下我該如何解決?
, `6 l2 n7 H! ]/ }' \7 O  V謝謝

TOP

sorry 太少上論壇看東西了 ! x+ c; N* V6 c/ }- o( ]. r
這邊原本是我用來丟些文件用的 8 z4 I) o' I( C: i# i
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
' B/ L) O( {# A/ ?9 R/ c5 n3 d, t0 z

% l6 u- u) T6 v, w' V/ M5 [. g
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
6 c0 [1 P' g! ~: W其實關於精簡網址1 m! W/ A: V" w! K( n. W! e& ?
這邊站長的教學寫的很清楚了# r0 G3 I3 H( G' g
謝謝: M* e9 d& A: u( D0 W1 W3 P. `" r1 w

/ i2 Q# @. c# H0 B但是我照做之後; A( n; S1 l) s
不能連入相簿了
) q1 _  o* [) i" k他告訴我這行有誤
# c6 Q8 j8 \7 V- J0 {* `$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶
- n5 J4 U8 A/ B! f2 `9 I说的太对了,赞同的赞同!!0 z) D$ p; p/ G: s: U# I$ P0 `
Ragnarok power leveling9 ^, T  l5 A. d1 \/ w
ro power leveling
; Z, k$ w1 |: _, x& K. mRagnarok Online power leveling
; L7 ?# @) p2 G8 q5 q+ o: y( x有事者,事竟成;( D& ?% o9 H# ^- h6 N
破釜沉舟,百二秦关终归楚;
" `4 G) T# S9 V  n$ o4 D6 Q苦心人,天不负;& _8 d- d6 b: f( V
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!. h5 Y2 a( m2 E! b' f6 Z1 R

4 S9 f* L; P- d$ _- H
& B2 j+ u8 {" N7 o6 X7 ^5 e1 F$ f
0 o- S( U/ ]. X9 ^( ^' L% o/ I( w+ @! M

) M0 q4 n, G3 o6 L
0 c6 i: G6 g9 \8 v
7 I* _8 W. }: u) m- ?2 S9 e
: p! a+ G' j9 B: w1 x! `* D
8 j) F/ c9 V: t& ?: G0 x4 B  n3 g+ G

, H3 z( }5 f) L# o" _1 k. S( j( n. H; u0 Z
0 Q: q* b1 G+ F; N) f% I
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!4 ?! `6 H* _! [& S

5 v- r' Z7 h- ?( |, }" V$ {# z& |. ]

1 g- ]/ a8 E6 ?) l' W' R
$ a  W+ y! |- M& r1 i) J; p
$ u) Z$ z; U4 p1 q: _+ G( ^
9 K: Q8 D- u6 Y9 ^) Z$ w. Y
4 i, U/ F. ?6 W: P8 P+ u0 {! X- y+ L& f. F

) ^1 r+ o4 K8 {3 m2 l7 ]0 ?' i. O8 u# s. C8 u
3 }8 N8 z7 Z; Q8 p+ @$ E

8 L; h4 F% S" {3 n) A2 e" n. s2 X% s3 M! b5 Z9 _, z* L
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題