打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
+ P! W+ [- }  g7 B& T8 G2 `
) b( c, a1 A* R  z; v) whttp://pic.segaa.net/segaa
! P1 }1 ^0 `% x. S# i
$ Z  C$ W3 G# J7 f/ g& Y自動相通於2 o, h$ E6 T$ k1 {4 O% _" c& ~

( q; R" w4 [6 e2 \http://pic.segaa.net/index.php?cat=10002
/ c6 Z, `  w3 V( K7 U" W* s# R) _! N8 t/ X1 x: Y8 ^  z2 s. X7 o/ U
讓使用者簡單的記住自己相簿的網址
, W, e8 \8 U, N, X. h7 X
5 N$ i2 L* b0 W編輯index.php 加入以下這些2 h) g4 e5 |( M/ Y- M1 c4 Y+ V
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

進階的精簡網址 ... 基本上直接開啟外掛就好了 8 D" z4 M9 {) j1 q* ]3 I
2 g, b% x# X8 \7 ?
1 w7 K& Z/ K! u5 b
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 ! `, _" O$ E: U
: l. y- B4 u9 J7 {# d: e! C
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
8 N  R% V% u( S8 U7 E    選擇覆蓋掉原本的 .htaccess 檔
! R3 H7 N( ^1 w% |* W% {2 }6 m& v) S" C8 C7 p3 Y
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
: Y; X1 J4 N1 R! f# Q. k7 Z. I2 |# s4 Y4 d& G. H
下面是我目前的 .htaccess 檔
' k, Z' v( Y# x5 B
, L- L* H  ?7 xps.我將 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

其實關於精簡網址
1 a4 L9 u/ c( D: ^/ [$ e這邊站長的教學寫的很清楚了
6 N; r  M7 A. |' D  m- V謝謝
0 c) G9 ?2 v$ x8 b5 E* e
  N- r& y/ Z* W" E6 ^" [8 l但是我照做之後
3 C9 I9 b3 u1 y不能連入相簿了! t% n# \- ]6 H2 ?% u
他告訴我這行有誤
) d$ r( X% r2 V: ^/ c* E$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
- ?1 K0 w% Y8 C6 {5 |- M0 A3 U7 Y(上面的cpg134_users我改成cpg1410_users)
% }+ {( _6 v9 \4 ?, Q3 B5 W+ ^: s, |0 Q4 ?
請問一下我該如何解決?
" v2 l" e; d" N  _6 c: {謝謝

TOP

sorry 太少上論壇看東西了 + B2 S( ~3 B. N+ o3 _# h* ~$ v" x
這邊原本是我用來丟些文件用的
8 o/ G# X1 ]; X4 W% [% W7 z關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
4 t5 K8 Q/ H3 R0 F
1 J* S& T2 ?( d2 e) E' B
' p' B, o0 ]) L0 Y/ [8 N0 B
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
+ X' _3 X4 p9 h0 b其實關於精簡網址
( n, N; g* x4 U. j這邊站長的教學寫的很清楚了
9 `/ c, e; }5 X+ J- p7 a! l謝謝
5 P, j1 S0 |- M: D2 S0 O/ i& l! d& F7 H, o  b. _- W7 O9 t
但是我照做之後  O+ _& }, l9 \/ C& h: \- o
不能連入相簿了
, s. u5 E: o4 j% r" D3 G' z1 g他告訴我這行有誤
) H$ w0 G5 Z0 `1 H: g8 J9 U! v$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


0 G$ Z; f: p% D" i# v( e5 g, Z说的太对了,赞同的赞同!!$ l" W) u7 ?8 n* E6 n8 e
Ragnarok power leveling  }* u4 _7 r6 I6 o% d4 t# W) w
ro power leveling
4 F) {& g) W5 W+ l+ eRagnarok Online power leveling
0 g( f! R& {& m8 @8 h& u! }有事者,事竟成;( I9 f! |2 H1 o5 Z4 C
破釜沉舟,百二秦关终归楚;& b" U$ ~' }$ z& T; w
苦心人,天不负;
; R; f( X" p2 d) k8 v$ r卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
3 a" R" L5 U# O- _( W2 h0 `) ?0 f
- M: n1 B# l) D8 L9 H  o, Q: F5 X; `7 X% C; i; I2 v/ z3 D1 [) X

) ]. C8 Z2 ]: b5 y5 U6 M
1 B: d) Z9 y( b& n% O
2 V- Q6 J/ y7 z: i9 [4 k( ~1 S& S+ K. J; z4 A% P8 V
' Z% b& s1 Q; y6 [# Y& V- y
0 Q+ ~" }2 ~8 |. M& g) t

9 I6 {" [2 ?( E; V
7 |* _9 m0 S9 |9 b2 B+ r8 M* Y' r& U
9 O/ Z8 `; E1 t( G. C
  r7 R$ I5 Z: T: R  A
# E& o4 D2 C, S4 w' a高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
" A- a2 I. w8 Y3 b8 w3 u3 ]6 _! r
& n8 O1 R% t& n1 W
9 p$ k0 g$ O, o) R
: e0 ?- a' C- K, ~9 D

6 T6 Z  y. D3 h( H+ [0 K4 j; t& s
8 k) M! F9 m, K  ?. f* e
2 A# p. Q# Q# ]7 ]$ ]& `
" h6 L# A  \) v, W
9 Y' @' r2 E( a( a" R1 X$ M
! E" I% m8 L8 ]4 X5 W  K  n8 a7 l6 }* E( J
  v/ q5 r, Q4 ^0 y* g

2 u  d, U- [7 t& ~A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題