Board logo

標題: [CPG] 精簡網址 [打印本頁]

作者: segaa    時間: 2006-7-30 01:42 PM     標題: [CPG] 精簡網址

基本上就是讓
- d) l! l; r. v! s% b9 I& u
; I6 C$ ]$ }) G+ X4 _  P& whttp://pic.segaa.net/segaa) t* s" s7 [5 i+ j6 I
4 l1 C$ A/ r1 }: y$ H  H3 i( Y
自動相通於1 y# z, v; r  A" |

- q4 F% g0 y  z# C" E; V, v' ?http://pic.segaa.net/index.php?cat=10002
" p7 K- T& ]9 A
, V; [: p* |: T6 G" s讓使用者簡單的記住自己相簿的網址
7 U# N' S, A- B- Q7 A; X" @2 Y7 {. ]$ I
編輯index.php 加入以下這些& o, O: P3 r! N6 o- S
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

作者: segaa    時間: 2006-7-31 10:56 PM

進階的精簡網址 ... 基本上直接開啟外掛就好了
- D9 t$ F) ], A: J3 b
: v% Q4 T$ V3 N5 F
  \7 O, M. D0 s1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
# `* E- J* C# {4 i* b5 C7 }& F4 q3 ~9 c) r$ I3 M+ `8 c
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
, i+ ]9 A3 g- ]    選擇覆蓋掉原本的 .htaccess 檔 1 T& B) r# L4 q& d4 N

+ ]2 [# [' v; a0 \. j) X2 ^3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
$ B8 m" H1 R/ J# d  P5 k: l* G, T+ W; ^5 H( Y& m4 o1 O4 z
下面是我目前的 .htaccess 檔
7 i7 U% W7 x* q) C( g( b7 v0 x! A7 U) c' N) M1 }7 T  o; i1 M
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

作者: prolog    時間: 2006-11-21 02:46 PM

其實關於精簡網址4 `, l5 T: o* J: [
這邊站長的教學寫的很清楚了
: U- p" Y3 p# S7 f) |謝謝
2 `3 m6 ?9 k; r/ ^: B& b& r1 u! c1 [/ r, C
但是我照做之後( m+ y+ {# k, u/ u& S  `: A6 H
不能連入相簿了. N) E7 x0 i) a' F" A9 P
他告訴我這行有誤
4 Q' I& o; |- e" P1 l! b$ [6 x/ l$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
$ e# \2 V/ e2 W6 o(上面的cpg134_users我改成cpg1410_users)
% B1 r' E7 y5 m! V! I3 J  t% B  H" X7 K' s# |! j
請問一下我該如何解決?
! J) ~1 v1 m) A謝謝
作者: segaa    時間: 2006-12-10 10:05 AM

sorry 太少上論壇看東西了
) p/ h8 ~4 [& M( R  c這邊原本是我用來丟些文件用的
3 l: H( E# f" A5 k% J6 I關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
6 ~% }$ F- D9 Z/ {' E* S  ~
6 H9 H0 d/ G3 I, n
7 J% W" U. R+ J* H8 Q9 ?' O
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表; B0 |" J7 c- ?
其實關於精簡網址
' S# f4 r7 E! ?3 C2 t這邊站長的教學寫的很清楚了8 F8 p5 y( x( N' N
謝謝; I2 ^; ~  N* c3 m% G0 {
  i$ n9 j6 O0 ]  m: P
但是我照做之後
3 M  V) o# h) d# J) L& r3 U$ H. S- J不能連入相簿了
' f' L+ Y+ d" l; {% |他告訴我這行有誤
; Y. k5 k: s- O4 w/ l$sql = "SELECT user_id from `cpg134_users`  ...

作者: xzig2thao    時間: 2010-3-10 12:10 AM     標題: Ragnarok Online usrmt power leveling

顶& f8 e2 \- Z9 F" Y
说的太对了,赞同的赞同!!" P7 S: S1 A3 C1 Q' |$ G/ Y0 @. |
Ragnarok power leveling
. B8 b9 O* D; r9 }8 _ro power leveling
& B! S5 u* U% F" v1 ZRagnarok Online power leveling
( G+ w& U2 r: ~& D有事者,事竟成;
/ |4 z) I5 P' r5 Q, r破釜沉舟,百二秦关终归楚;( a0 ]  ^8 I+ w" p
苦心人,天不负;
0 l$ e. L" Q" `4 X, f* L卧薪尝胆,三千越甲可吞吴。
作者: fack10    時間: 2010-3-13 12:56 PM     標題: 支持!

支持!- b" _# k0 ?9 V8 o# S- y

! y- _1 c: k' i" ]+ f  y- N; L4 y- L: H/ i: p/ Z4 W- d9 o8 b2 p
( t4 I* w4 g  @5 j  d; H9 W
  y# S. \% l4 o' k' R

% j& `7 F1 y9 @" E1 R6 [  K  W2 J  i1 }
+ T9 F: B5 H, L+ m! T  ^# E' o" y

0 ]: D' r9 p" n/ U& D
6 k4 R0 N* Y! h" w- W) v2 q3 s1 w- ^  ?% c% w9 n9 B& ?
' O2 q1 `" O# {/ k2 Y
$ t: n/ r: z( k0 Z" Y
$ o' c3 N% `: d
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管
作者: fack10    時間: 2010-4-23 11:44 PM     標題: 支持!

支持!( m  y  @: L0 n5 T7 {" e; T& M
' O5 }% g1 ?; d5 U4 O) L

/ Y. g- J6 P5 w: e9 p- L0 T1 e, y% f
7 u, ?, B5 i) ]  s/ @+ c
; g8 ?9 }1 Z( p: @

; E; m4 h% M! A9 b7 n
) `8 _, d; F' _' y
5 l) k% i4 f( l. Y* y/ L
& {3 I* `- z( L7 l6 }0 x7 m3 I9 I6 l$ G6 G$ `) j# a+ F: @

0 [1 ]; l3 g8 R8 G! W& Y8 _  S2 P  `0 A' z) e# y1 B3 l
" s: l0 _7 u1 q0 B; `5 A. s
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管




歡迎光臨 幸運草之戀 (http://discuz.segaa.net/) Powered by Discuz! 6.0.0