打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
3 P) _+ o( ?- Z2 s" g0 j- }$ A2 ]( x- r
http://pic.segaa.net/segaa5 M! R9 C& Y+ _3 B, E

8 ]" A& s& M7 ~8 B# T自動相通於
1 V6 a  T  _6 q  B- n5 [" \
% E; Q/ X, r  j8 chttp://pic.segaa.net/index.php?cat=10002
0 K3 F+ \5 N  h8 V0 t3 t" |: l: r; i& u  `
讓使用者簡單的記住自己相簿的網址 & M0 W1 d- f  a, S' i& F

( q( ~3 j# D1 c% R8 q4 X編輯index.php 加入以下這些
6 Q, g- u& e6 N$ L. Vcpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了
" f+ U/ {  r$ q: r' i
1 Q6 ^7 _  R3 \! l2 }: R, p8 a- w- u4 U2 e
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
& V6 _6 |0 C: X4 g* [$ J+ x  z4 u6 ?' ]& b3 z
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去& m5 p& a5 y" T0 P) _/ ]
    選擇覆蓋掉原本的 .htaccess 檔
# C; m) e6 H8 [1 P. O% R% M% D/ T8 @$ e
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
" b5 Z. k1 ]8 F  d
% v* Z+ S/ k- {4 q. m下面是我目前的 .htaccess 檔 ) x: e2 `  L  y/ ^* L

: |# q4 k0 H3 H  j3 g! Mps.我將 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

其實關於精簡網址8 s0 C1 ^, _$ k7 a& L( a/ }
這邊站長的教學寫的很清楚了& \  \; A8 M) e" p- ^/ c
謝謝
+ F9 N8 m- E& D/ \2 W
+ l3 @5 r' a5 T! r9 I但是我照做之後" b& G2 N5 m9 O0 l  Y/ p% V" V
不能連入相簿了
6 r. T; j1 Q) u* l8 ~6 ]# X他告訴我這行有誤
8 F" F' f0 h& ~; q3 z7 n/ Q5 K6 L( q$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
( q3 K% c# P9 T" A! H(上面的cpg134_users我改成cpg1410_users)* `% Z& P& X* y* K: h

' G, T  A- _* B6 x1 c/ ~' r% T+ T請問一下我該如何解決?" Y- F) Y* M, z$ u1 \( u
謝謝

TOP

sorry 太少上論壇看東西了 # G& M( g; G; }# Q1 _+ j* y
這邊原本是我用來丟些文件用的
) }1 f: |& j% `7 f1 g關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱: j3 v2 |* m( C! G# l) Y1 j

, P/ h) V( Q7 I
' \) ~) j6 @2 ]) q1 G, P
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表# P9 _5 n) p% N1 l' J3 r
其實關於精簡網址
3 H/ V- [% D1 G! J" M( M這邊站長的教學寫的很清楚了
: A3 ?4 u) c3 G- r/ Z- ~" [# Q; X謝謝9 u8 M) [  V& E8 V  i* m
& `, `, X) m$ ~3 f% d- B
但是我照做之後
* Q" v  N  K" @# t( z不能連入相簿了$ ^/ k2 P+ S$ f
他告訴我這行有誤) Q  }9 o2 e# C+ N, t' q+ B+ X- h
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶: r* t0 d, C' z* G: \
说的太对了,赞同的赞同!!6 s# U; ~+ v6 e: F& g$ R, i0 \& ]$ o
Ragnarok power leveling
2 a( [7 r2 |' H4 k# X: {ro power leveling
2 T& K2 n2 C* cRagnarok Online power leveling) S& h/ [6 {4 C7 ?; I
有事者,事竟成;
! T* H) u5 u4 o5 A破釜沉舟,百二秦关终归楚;- Z1 Y2 p  K3 o
苦心人,天不负;
$ z+ w2 Z' _! B( A/ V! [卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
9 \3 ^3 a; A% X/ l5 O- ^0 x
0 o. h7 a2 ?; j6 i- v# a5 f
. H- w# w3 d& T2 P4 s$ W2 r- Y' ~6 s5 t; J4 k* N
( V+ {; f1 |2 c" U) B; E! Z1 A9 L
0 L; c' b9 @6 s, @6 K

8 k+ |0 F6 }' r( u4 V, m2 u, q( {& d% D) k
. C" ?' C; F- s! s, _- C* m8 I

: @: O, y0 T$ @. h% A2 S" ^( v
# S% G5 l/ m, Q, }* Q) x$ B" w# H0 _3 {2 K/ _! w$ q8 U
: y6 G/ H  r' ~/ {; q

; N% ]7 ~. J9 y# f高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!. ~; H1 y' E/ r6 T7 e  F+ x- G

9 A5 h) l( L8 E. m' s' P( n/ V2 @' [7 K: O

, I9 g2 ?- t  G* J: _
5 Y! p, u+ J* V& a8 H. Q
' j3 ]7 Y5 c" Z- @( `
+ N: ?6 {" N. X* Y+ z0 H5 u
! B# A- W, h0 m$ ]8 z2 ?# S# j; p, v# g. n9 J: V

$ ~$ u0 X7 E% Q# s. M- R" R. P& W0 b
: p; y% l& h, ?/ d3 W

! G) o, [  [, J: s$ E8 O9 u+ j, W6 n* h8 }* @0 f
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題