打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓: P3 o1 ^" \: d6 w
7 k+ o0 |9 \0 {- S' B/ h- U4 f. X
http://pic.segaa.net/segaa
$ A. i6 a. r5 O# `9 I$ ]6 S2 b9 ?4 l  a/ i
自動相通於
* G$ j3 B9 E8 z
& J' p# }0 {5 D5 r+ N( Q6 Dhttp://pic.segaa.net/index.php?cat=10002* ~) B) j. U! J7 c

, P! h/ R" ~. k4 c" o/ U5 k, X讓使用者簡單的記住自己相簿的網址
+ y) a0 _. U) v% `7 ]* s& z7 B, L$ K9 k# y
編輯index.php 加入以下這些
: Y( X( N6 Z7 g4 D/ ~8 G+ |) q0 wcpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了
) Q5 u( Q: f+ z! h. q/ ]7 d% W4 i9 ?7 t1 C( u1 U, g8 z% I! ]
7 x* ?1 L! N! j, E3 K
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 0 }" H) G- a: Y% w- E
. v) P7 R% w6 l+ M, s  @
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
% f! y7 w6 b+ s/ X    選擇覆蓋掉原本的 .htaccess 檔
. _$ u7 i& q/ @# Q4 e0 e) }& G) ^6 S3 _* q
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去+ E: I% \) v5 ~, u8 i- j+ ~

* A4 E* E6 g) E1 j- W( E下面是我目前的 .htaccess 檔
/ K3 O: D: a( _; l8 G# e1 V' D/ U2 b% s
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

其實關於精簡網址
* w. y3 M2 l; {' a這邊站長的教學寫的很清楚了
0 H8 R8 H2 F5 e. @. n謝謝/ H, {7 R5 b+ i9 ?2 w. Q, G
6 D' o! r$ p* h4 k/ {' H
但是我照做之後
1 M. I7 e: Y; V) K* d+ x1 J! f' R不能連入相簿了
! O. P9 _2 I1 @# k% F他告訴我這行有誤
! R& ?" F2 n1 I5 Z# P: Q" V$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
) [% O' H4 o) z(上面的cpg134_users我改成cpg1410_users)
9 L' e/ g1 n+ ~- }) G& s/ {3 {! @4 A: d2 F3 `2 E  a
請問一下我該如何解決?
  U9 z8 @: |: A! l" W& B) s* m謝謝

TOP

sorry 太少上論壇看東西了
; J/ Y: d/ b  c) `這邊原本是我用來丟些文件用的 4 U2 J. H+ E8 w5 R! T! u
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱, `  x2 {2 O4 P8 N" i$ y

, U/ t4 c1 j0 J
: }9 \; u! p3 o7 m/ Z9 _" S4 T
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表9 }& g! F, a6 P4 S
其實關於精簡網址* f! ^; e; e+ }) \
這邊站長的教學寫的很清楚了
) g1 F" i" C9 r* [謝謝& S$ S3 D% c9 s, k! B2 [! R

! x, d& N2 [4 p9 s但是我照做之後
% r5 A! P! z7 I不能連入相簿了% o" V( X- k4 m" j8 y0 X; d; u
他告訴我這行有誤
4 c$ _) h- r8 W& I, B0 F5 U$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


9 {( r1 K. a. M! F8 H说的太对了,赞同的赞同!!! Y3 G8 P; C/ N' k) |
Ragnarok power leveling- h/ u2 @  w  H$ {
ro power leveling. A. h' F, S# @( c! |& |- V
Ragnarok Online power leveling
: R! y6 b# \0 G, p) @" E3 @5 x: S有事者,事竟成;2 L0 [8 b. v+ ]2 T8 ~; O1 N
破釜沉舟,百二秦关终归楚;
. c8 F% L/ u  m, y! l4 s8 X苦心人,天不负;
3 d3 z  ~% j# z! x卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
: K" r, a+ \6 p$ v) H- k1 f! X5 [' z2 {/ h+ e

$ U; |! d. s* f+ q3 O
- a- ?6 ^# U9 A6 F6 C# x& x  Q! T/ B) ^! V# v
* f  w3 N, z' Q7 @0 w

  g; a$ s) R, \0 y6 S
6 Y  ]: @# T$ R' @' i5 s: t3 K- w5 o# d) g* q2 E
9 Y' _# Z' {# F9 ~" m! x
  x: T$ m. q. I$ z* L$ m" l1 V$ L# a
, T7 P+ Z. ~$ }" I
! {  e( U+ ]4 U& l. F

# ^; B" N- X* c# n; M, A6 n, W! o高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
0 ^2 M  h3 x3 c
# }& P8 @9 R. M$ c6 q( q! ]1 U0 N  D. Y. g9 k" {5 I* I
# i- q; V) L3 `# B

* ~- @& F- E! f4 U2 l& p" F; \8 `; `! }; u/ F! \
0 @! Z) F2 ]3 c0 d1 e

. @/ }- O( A8 ?3 u
0 C+ W- @0 V' H4 ~$ z/ t5 g
# k+ S5 t- x; I1 A9 C) S# R
) {" y$ N7 ?! q) ^+ i1 \( b  s3 p$ d0 Y# r' p  O

$ ^7 J: }6 x& ^' A8 ?( }2 c
  k# z& x4 s7 r! d5 o, [A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題