打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
% E& L5 Z8 ~9 I! A' \1 i+ u2 e8 ?
http://pic.segaa.net/segaa% t/ I7 |& H% H/ O) E

' A, V$ M$ c& i) ?/ {# a* m自動相通於( O$ v# Q8 n% r& S6 p/ j! ^
0 r# H1 E  F1 P+ @$ _, a
http://pic.segaa.net/index.php?cat=10002
# O8 n6 _) N5 F3 o$ Z& k. F+ L; D( U  J/ i
讓使用者簡單的記住自己相簿的網址
: A  `8 y; |3 y* z! @2 i  ?* N9 u9 z
編輯index.php 加入以下這些! M8 e% t; H2 f$ i$ Q
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

進階的精簡網址 ... 基本上直接開啟外掛就好了
) [5 ~* O6 I9 ?' \8 t! b1 ?  R/ [
2 {, A) ?% T  ?, W* ]& z! h
, h" J! U& p, U$ h4 B; V$ J1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 , m( p, c0 r& ~3 r
8 G) ^& U! _% F5 {" ~$ J0 R
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去3 b' }7 x1 ^* e* X, {! {
    選擇覆蓋掉原本的 .htaccess 檔 7 P( W+ e, p0 `3 \

" Z" |9 K  Q5 S& X3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
3 r4 M0 z0 J6 E* {5 o! X, H" |) y9 O& N6 ]
下面是我目前的 .htaccess 檔
% Z% P: r. `4 x. a& X) u; r/ t! E) L  [, w
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

其實關於精簡網址8 F; g9 m; g5 H
這邊站長的教學寫的很清楚了- o9 z6 T1 d, C& u* Y9 x& J) M7 A# d
謝謝; V& b; Q; b$ q

: d  O; Y% m- A+ x1 R$ }但是我照做之後/ L: O. y2 G2 b* |( B+ V/ d  V: b/ z; e
不能連入相簿了7 C: |! s% H; x
他告訴我這行有誤
; C; I* m6 ]6 v; M, M$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
( c) C3 A/ `  ~- w6 e9 ]6 f3 G) k/ d(上面的cpg134_users我改成cpg1410_users)
; A' d) H: G. d
2 s% Y5 j8 E, u- u請問一下我該如何解決?
" E! z( i( R; I  G謝謝

TOP

sorry 太少上論壇看東西了
# r1 V! ]: H1 u這邊原本是我用來丟些文件用的 * _, d& v: V8 k! B
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
0 S  c, g& |& X& w
  [$ C$ D5 L9 S' o( w& h4 P7 H+ F- w; a# H. L) h0 T  |3 w; p. F
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
' H9 m/ [4 o3 v4 `( m1 p+ q- C其實關於精簡網址: P$ A7 R  h) R9 }& v$ n
這邊站長的教學寫的很清楚了& V( a1 g8 z" j" I' f% Y& y' P: m2 b
謝謝
3 j6 w# ?* }9 H- f$ z
$ ]* W! l( m) v% E8 l7 S但是我照做之後& g% N. s" J$ J# |
不能連入相簿了  ]% M" D2 Z" f* l6 [+ C- E
他告訴我這行有誤* s, S% O7 U: Z& c/ G7 \  d
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

8 c1 p1 d8 i* y
说的太对了,赞同的赞同!!
9 s# a0 l  C- h4 ]6 ?( GRagnarok power leveling
" \  I- A& a1 uro power leveling
+ S; }& \' P  |( i/ |9 O1 jRagnarok Online power leveling5 n: @. Y8 \- ~
有事者,事竟成;- e! m. w4 T8 n! t. e. a
破釜沉舟,百二秦关终归楚;! _, a* M$ x4 Y
苦心人,天不负;0 T" `' v# F4 G
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!* j1 `& h4 Y- H, w8 n1 R

+ {2 t+ }7 B" ~3 ?) j% o6 D* h& c# e! B9 V0 P9 z9 ~- s" ^
- A7 M$ B( l6 s

; K# u- D* I5 q2 R
" u; x, D, P" f: x  K" u9 e- k  H( N. U3 D! Z4 R# E2 I

# K6 I( \* S% C( ^7 H0 Y8 z8 I
, K- e2 B! g$ j- J  B+ ~- _2 p( X' ~, W, x) f0 q$ Y
$ ]- E6 O3 K! k$ c, P( X5 T

, p" ]1 B1 D: X7 k/ W* v! y! ~( b# K* i5 c7 q9 J" [
+ n- m- o& W8 t3 h
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
1 T# E+ f9 ]+ A' I, ^. H1 n, T/ N* v8 P+ E7 d/ z

1 x9 w* y5 F, C0 J! [
! A. z8 U. B+ U# k" a, x
, r0 \: g, y5 N, {0 t
4 L6 i2 S$ d, v- ]2 ~1 S# ?. o$ S5 s; G+ w5 W6 F/ B2 p& k
2 t4 x# U5 K$ i; _+ E

# z* y. l2 A+ T; C# D3 q2 @; [/ ^( v" C. b( h. v
0 O7 b/ X1 {" ^8 j/ @6 W5 V
+ r! r# y1 h/ h1 m9 K# B
" y& F; ]/ H! ^" x& G' z
* Y: @" t' @& _$ F: {
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題