打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
7 p5 p  E. D; m  S' |0 T
, |$ V  W  J5 D/ ^9 P+ s1 l8 Dhttp://pic.segaa.net/segaa
8 E# }' t( I* a& ^  {
/ R4 A7 z% \, b) a$ h1 `+ j8 G% ~: n自動相通於
, m: [( D* B) K
2 r9 p& A1 \* Z0 W$ ]7 ?http://pic.segaa.net/index.php?cat=10002& k& I5 H' u2 W8 W8 L

) ^; {9 H5 f& b6 D讓使用者簡單的記住自己相簿的網址
3 b! ]: Z9 V2 k
( D' f& [) ]) ]' e. C( K編輯index.php 加入以下這些" s) F; l3 G5 k& n
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

進階的精簡網址 ... 基本上直接開啟外掛就好了
: U2 W: G8 T+ H5 p/ y* b5 s  h+ Q' n1 K, O5 r
7 x: Q# I0 {. a3 [0 ?  x* u
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
% P5 J; {5 I8 e( u# l, O
+ @) i! V( e; f" j7 V2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去& F( _9 R8 D7 m5 V0 M) t' Y
    選擇覆蓋掉原本的 .htaccess 檔 ; u3 G5 W. N0 o6 _% D% U

) N9 o. N1 B& y( z3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
; \7 o6 D5 o! a9 B( o- Z5 x2 P
6 V9 P& Z3 u+ ~  ^下面是我目前的 .htaccess 檔
( x4 J$ ?% E  s) \3 }: P+ D9 }0 F. _
; M. N6 B) G7 Aps.我將 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

其實關於精簡網址6 u% a( {5 r) C( V" m0 x
這邊站長的教學寫的很清楚了+ V' J( h" [+ d+ b! v& U) u4 K7 M4 h
謝謝
6 W% d* [+ e, J! I, y
0 o$ \; S8 M# F但是我照做之後9 q) v; F  W- a. a
不能連入相簿了
: ~! c0 O7 v' l8 \: z他告訴我這行有誤- d* u; v( p1 P0 n- ?+ e+ C8 ]; Y& G
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
: }- o8 L9 d" m3 n(上面的cpg134_users我改成cpg1410_users)& C3 C( y  B0 b2 V4 V
7 \- x/ ^2 k0 W' [
請問一下我該如何解決?. O+ b7 x. H% p
謝謝

TOP

sorry 太少上論壇看東西了 ! A- p5 \  q+ b* t+ E8 s
這邊原本是我用來丟些文件用的
4 N: w& Z# a1 A9 q3 ?關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱: L# ^0 w& g: n8 B  V2 o/ h) m, Y4 R

2 q; j# s8 l5 |- Q) X: |! W) y  B
* v  }6 y1 f' J0 t! F, [1 H; m! S& K
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表4 O7 a* Z7 L7 z7 T
其實關於精簡網址& B3 T& u1 Y/ f9 R
這邊站長的教學寫的很清楚了
# c9 P+ L: {$ x. D$ M2 Y" l謝謝
9 L$ X8 R8 m% b+ j% V7 E% u
. |# X4 o9 j! m- X但是我照做之後8 P; V$ ~1 L/ Z+ `5 ~/ [+ y
不能連入相簿了
7 n5 T  m# u2 y6 `他告訴我這行有誤- i8 X$ a' T1 h* r0 R
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


3 Z' T, H+ k5 {说的太对了,赞同的赞同!!7 @8 w2 G2 e3 Q" E( T6 h$ S
Ragnarok power leveling2 _, N4 T0 F, O7 b
ro power leveling# g6 |5 C! h& Q: v2 R
Ragnarok Online power leveling
  ~, }- \8 \6 c4 G6 L8 z有事者,事竟成;
( K, j* X2 d( w5 }6 ?7 m破釜沉舟,百二秦关终归楚;, r& }' P% X! l' p% E  ]
苦心人,天不负;
' q# E  O% P8 ?" f2 ^6 q卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!$ w8 L0 v, U" f4 \  _
5 R" j5 v" R: g1 {' ]$ }, x. m0 c
) z; F/ m3 z' U

* B9 P" V& {, ^0 a/ a' A0 F$ o( ]9 e( u) f2 W
4 P( H6 Z& v) I+ q$ T

6 X- T/ ~7 X! `+ k5 G% G% o+ @4 r' B" I
+ T5 s2 {6 V) w& T% q

) ^3 Z; u5 A8 t7 k+ |8 b8 u/ B4 [) {5 p) l% R, k5 e

* ^$ k) C! j; l9 H6 {' w1 \6 U" i8 U

! _/ g7 w' U- m( @高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
, F. _1 B, K& O: g+ p
+ R# b' q2 ~$ j# P) F- y% m
) g5 i( ?+ m( `( W3 f. ~8 G/ y: B1 I& u7 }/ q# s3 x5 J

) f. _1 z9 G, ?$ v  D+ R' B1 G
# x& J' `! h% m* V) A' b; d& I3 H- F) C+ _* o4 w
5 C5 z( K& J. {3 t' q  N/ h, S

4 |' O$ ^% i* y* Y5 F( Q/ h9 S$ X" l7 U, c

9 X; K7 Z" V: Q# v$ U: q
6 S/ f, }0 f! {8 c" `1 O; L; s! q" L2 n  j. P9 I" o  B

, D5 I. H  \' |0 T1 u1 _% N( A& @A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題