打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓6 y/ n' n( l# H6 q1 c# N0 |

  E/ |  t6 p7 n# b7 \http://pic.segaa.net/segaa
% {! d' r9 A) a7 S: @0 H( D* {+ f* h9 y1 `
自動相通於
/ ?2 W0 j/ q- F6 p5 f# H" D! ^3 P8 O7 u* X6 u- g3 V
http://pic.segaa.net/index.php?cat=10002/ n  L! w) \% V0 K$ y" v

, v! Q& Q0 ~/ P* j: I+ F, r7 [讓使用者簡單的記住自己相簿的網址
+ |0 a+ c' Y: Y  J& I9 Q2 |# T( W
1 U8 \% ?1 x5 \編輯index.php 加入以下這些7 o9 _& J& l! r) j" g) q6 e0 J
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

進階的精簡網址 ... 基本上直接開啟外掛就好了 6 O2 u& H6 _! s: o. {) R! t

' Q0 ?' o" [8 j/ q* s; D
+ r) R- m+ i( G# `( f5 l0 T9 t; M1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 . t3 X* P- d1 O5 X0 w; G4 ~" r/ E

# d) s5 r4 C, L' z& ^0 A1 t2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
* S/ z+ _7 W9 B3 e  Z( ~    選擇覆蓋掉原本的 .htaccess 檔 $ j0 }* i! Y  ^/ s  ~5 _1 a( X
/ K* L4 f% u/ L% ~0 F+ @! x! o
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
. }/ m' x# r, J- q3 O; R1 \# R
9 s# r* O* q/ I- s# c  K! A下面是我目前的 .htaccess 檔   M+ y5 S, W7 u. E  M; O/ i

& G. V! s! {# kps.我將 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 B+ A+ w' z5 V; _9 J' z# \這邊站長的教學寫的很清楚了% |' B9 N' t1 _8 X0 [5 P
謝謝
( _" I3 q1 R* F4 h2 v/ X3 r5 z& x8 N$ [3 s9 O  d0 Y
但是我照做之後  u8 a* I& B% q" q) N
不能連入相簿了
4 R9 g8 @) h4 F4 D3 m% w$ w% [他告訴我這行有誤
) g# S( V+ Z! Y  Q( L. \4 ?+ X$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";8 W5 O: {: k# t" R. j
(上面的cpg134_users我改成cpg1410_users), ~! F) ~# `, A8 W) {) x

1 @3 R9 f( e7 d2 g請問一下我該如何解決?
7 [" c, v: t1 P* D  r, R謝謝

TOP

sorry 太少上論壇看東西了
- L) U/ x5 k7 k- c0 e這邊原本是我用來丟些文件用的 / [9 _: R  P" Y
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
* r5 ?/ X2 H* d
1 q4 }6 X3 I* Q- J
. m) ^& i. ?# ]3 {
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
: G" b# P8 a* S2 `. P, r其實關於精簡網址% W3 ~, i" ?* V) d4 Y* \
這邊站長的教學寫的很清楚了. a" n* W( Y# @& G
謝謝# W- a/ q' U9 y3 f0 x/ h% p: z

! ]$ u$ ?  T" f/ I9 i; b3 T+ p但是我照做之後' m' n. I% r5 g9 e# Y* ]
不能連入相簿了' |. G8 p: ^+ h/ ?% X$ {8 Y
他告訴我這行有誤
* }" A7 n! _6 F5 S( ?$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

顶
/ _& P/ H8 y+ _2 K8 y# d说的太对了,赞同的赞同!!
' b, i9 ~0 j' W. C. @2 @Ragnarok power leveling- p3 j2 `  I4 Z2 j
ro power leveling3 v; |- W( |! V. v: d; v3 y9 X
Ragnarok Online power leveling) M: `" e  L& A2 ~4 i/ T
有事者,事竟成;' I  a* ~4 \* j
破釜沉舟,百二秦关终归楚;6 P" s& j; C0 b$ r- K' n/ W
苦心人,天不负;& f: J! u  F0 n
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!/ W$ [9 [5 M4 w
9 S% h1 p7 [9 d1 R7 f/ n  H

5 Y, x3 o  h' Z7 u2 @2 x2 x! Z% L& z" {
8 r9 M3 I1 y, C: P, @5 |7 A( \
! k5 j9 D& G) u/ o$ ?. Z" a

' [0 d) Q& x2 W! f* F9 b8 Z! y( ~$ u4 G! g; I) r8 ~' x
. C/ D8 [: }0 N8 a8 g

; l: B4 K/ w' M" G$ y- O' r- N
  h7 s, p6 O' h4 \, o7 q! a# y
( T3 `8 k/ E8 q8 s3 L) H8 {/ q+ d! E$ {" B

2 x$ B6 G6 {  U& p- W& {1 @高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!6 R5 T5 q0 s$ v/ i# a

) n* P1 o6 l  s5 E% j+ [; w* u/ \; J4 E  t* d

  Y! S. o- u0 R6 ~) A; {1 Y
5 j7 z" K" e! j- ~) s. W) ]) n. H! z

8 o3 a% y8 ~6 V9 F, [! H# H. h$ D( n$ l* i6 B# D

) k- n8 g. a6 b8 _& U8 I! f9 y3 n0 t5 L* ^1 B

# l1 l% ]. e3 R0 ~' f0 B9 P7 U5 i% A2 ~8 X6 g+ L
' U4 y8 k# P+ t" P( H

, ~3 N# t+ }! S  S9 w& k+ \A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題