Board logo

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

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

基本上就是讓" A  O0 t3 C9 j' ~& Z' X) Y

" _4 K. W( ?$ h9 [http://pic.segaa.net/segaa- Z$ n7 c& v# F: q! ~

) h& L4 u3 x& R- g0 G3 l自動相通於; v" z1 i- n0 n8 }4 J

9 C3 z( Y+ B. l) a$ mhttp://pic.segaa.net/index.php?cat=100020 T7 Y2 E9 t. T; N* @0 f+ h
" i& W" F# @& x  l2 a. b" W
讓使用者簡單的記住自己相簿的網址
2 y) \! f; N* d) D' S0 M/ n1 ?
3 u5 ~1 f8 _/ l9 f! n9 c+ {編輯index.php 加入以下這些; @: J: T5 Z# f' X6 G  \2 W0 r
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

進階的精簡網址 ... 基本上直接開啟外掛就好了 9 r1 [9 U, T" c! K/ U2 q
0 p" A9 p8 q* _: {7 J' o2 T' J+ d

# k  c; Y& {9 B" K; p. C1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
! ]) @! a+ m, D0 O( U/ @" s6 r7 c; t' D( {1 [1 b
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
1 x& x! Y4 k, f- `' w' i! Y: V    選擇覆蓋掉原本的 .htaccess 檔 , U# ~, K( g- f0 ^6 z4 |3 i

9 d7 Z8 D3 O0 R5 e+ t9 @( j7 ~3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
' m! R( N( d- G1 T' f# T# V4 f- ?; ?* a1 v4 m
下面是我目前的 .htaccess 檔
; d: O( J0 b+ ^* `5 ?1 P# z. x0 G# Z9 S( J7 x
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

其實關於精簡網址' d/ \# U4 r2 {+ \# I- ?
這邊站長的教學寫的很清楚了
% o* c6 r3 t3 M謝謝
4 ^& y! X6 i8 \6 f7 I% z6 z: K/ o! M6 L% p
但是我照做之後' @  k5 @! h) [
不能連入相簿了
2 S8 ^$ N, a/ [, }* W他告訴我這行有誤7 p; P9 H* j! C2 J1 D5 n
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";; Q8 p$ n  S/ P& Y+ Z5 @
(上面的cpg134_users我改成cpg1410_users)
: [$ m- z/ R2 M; z0 p' b2 B5 r5 F' m5 F$ r/ q3 e
請問一下我該如何解決?3 n: r/ `- d+ `' ~9 h
謝謝
作者: segaa    時間: 2006-12-10 10:05 AM

sorry 太少上論壇看東西了 $ M+ n/ G0 {* Q+ R
這邊原本是我用來丟些文件用的 " @2 L5 x9 V' `* V+ E
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
! ~5 C- n8 I2 l( V9 P" w: v: R/ L5 G* D, X2 o4 ]; a

+ g5 V( N9 \1 d+ ]$ ~$ F3 s
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表  G! ~9 c, h8 J3 B9 A0 j5 W; @
其實關於精簡網址
6 P3 A+ Z0 X! y: _, E0 _這邊站長的教學寫的很清楚了
! `0 I2 i5 N" B* w/ n2 t謝謝
" w* r, f7 M3 L; X; n
9 M# X! C( T+ `2 d" L但是我照做之後
. U3 o& L2 D# a3 ]" u8 B: }不能連入相簿了
) O. L! p+ \# V+ `9 W8 ^他告訴我這行有誤
' P7 h9 C. c3 Q! ^- M6 E; T5 N7 \$ `$sql = "SELECT user_id from `cpg134_users`  ...

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

顶
0 E1 ~# M/ v7 o: w8 O说的太对了,赞同的赞同!!' c2 L$ Y( I% M1 i* S/ E
Ragnarok power leveling
! r& f, e6 o& T' y, F8 Ero power leveling& \. g6 V9 c# \( z/ |
Ragnarok Online power leveling
3 |2 d* H' {: \有事者,事竟成;
, R+ A# S3 W# ~+ v3 S% J+ ?$ Z破釜沉舟,百二秦关终归楚;, Q% `0 P; V6 s* o1 e& f* I6 e( g6 |
苦心人,天不负;( p/ E! o& v+ L8 U
卧薪尝胆,三千越甲可吞吴。
作者: fack10    時間: 2010-3-13 12:56 PM     標題: 支持!

支持!% G8 u& X- u: l; }" y2 M
8 \6 _1 Q% J* Y( S$ w

" j% M+ z2 Q* V, Z% F" c% Q# j  n! u, l2 l. D# ]

% q5 y, a# H) H' d; e
* P# ]/ f% U. @7 \$ w8 [- O5 K# {( f/ @; |8 u

8 D4 @9 M7 s/ _3 v) [2 {; F' P4 Z, ~9 l& a6 {/ U' ?! w

( P4 s. `! b7 L: m
0 |& z- y) n+ a, \" r* Z
5 y. s* P6 p, S7 h9 m- H
3 ^/ a( _+ {2 W# J6 `3 a: \1 ^1 E% o" L
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管
作者: fack10    時間: 2010-4-23 11:44 PM     標題: 支持!

支持!
* [; `. D# I( R) p, J, {
  q4 V) T/ T; g% r
( V2 ]% h- v* v' ]5 Z& k4 Z
: h$ }% R/ y6 \) v6 D/ _+ B9 I7 m
8 p% F9 n% {1 W: ~2 A4 B& E! Q: ?) u* E, E
: ^" k/ ?# A6 {7 P, }4 H3 e) J+ }

# D2 u5 I. g" }9 t5 l  x
& I6 R2 L  n" @" N/ e' S& D1 L+ e4 P& T& N5 f/ K
9 {0 b2 n3 e7 r2 r% }6 D/ x1 x
; i" P. H+ O, N
0 l  c& ?2 t, F$ d& D  g! B
5 a6 F; X; Y/ {$ \- b
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管




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