Board logo

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

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

基本上就是讓) Q& t. E6 V+ F: g1 Z+ }4 ?7 [  d

4 P7 @! t8 }7 p7 P4 ?* whttp://pic.segaa.net/segaa! K* A: g$ B- F) R& |! M

; M  d# Y. [9 }! {# C9 O自動相通於( R5 G2 A* @+ U5 F: u

# A$ i0 y! a8 khttp://pic.segaa.net/index.php?cat=10002
. P& @6 @0 _' @8 h- q# E+ }- ]2 r/ i; |+ v
讓使用者簡單的記住自己相簿的網址 2 @( Q, D* I; x( N/ A4 @; }8 Q

/ E# N# h  g$ @編輯index.php 加入以下這些
& ^/ f5 \# K- \" V  W$ C& d" pcpg134_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

進階的精簡網址 ... 基本上直接開啟外掛就好了
$ Z5 C: @9 }' u$ z. ?) j- w; P0 F
* E. Y) T: k/ h) A$ _
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 4 c) y' t8 K0 v1 x% C. P' d; d8 S
2 j' v; h8 O5 B( L9 f4 G
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
2 O$ w5 D% [' t+ a    選擇覆蓋掉原本的 .htaccess 檔
& ~4 r; B- ?9 G, Q3 R- _. m5 Z+ k! m" C9 G8 N4 u' k" m4 j5 c
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去6 i! V) i6 g5 C0 U! L! J

  ]( t3 }/ ]2 g  k# `下面是我目前的 .htaccess 檔
& W$ k6 f2 s) _. _' @, X, t8 a- _! @" I+ 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

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

其實關於精簡網址( A% ]' E1 X: r7 L7 |+ _
這邊站長的教學寫的很清楚了
, B* K7 }) K7 l/ J. m謝謝( s' @  h- L; w
( p9 M' g& X- n. ^2 j3 }  c. O
但是我照做之後
8 m- h! @$ _# j/ F不能連入相簿了
+ [, U% n# y3 B3 ^! t. N( S1 K- k他告訴我這行有誤) E, @0 C/ N0 U
$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";$ w' q) K% }. f6 H9 g
(上面的cpg134_users我改成cpg1410_users)$ ^. h0 \1 S1 {- a
9 c1 Y% m5 J: j# Q; X* B
請問一下我該如何解決?' `7 o, \$ P* K
謝謝
作者: segaa    時間: 2006-12-10 10:05 AM

sorry 太少上論壇看東西了
9 z0 Q1 }2 Y4 i& B5 S這邊原本是我用來丟些文件用的
& L; o, {! z9 U8 \9 b/ D關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
/ o) y6 p. [; X" V; n0 V; N) u- |  b3 |% X# D9 K& w
/ G- B8 u+ S  U1 I/ d. p+ u7 ~  M
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
# N: S& I1 l/ y, y6 x7 h; L其實關於精簡網址
2 o+ B5 M# W8 C. ]6 o' b這邊站長的教學寫的很清楚了3 f1 G8 c7 Y4 G  W, Z4 ~6 B
謝謝. @- ]6 y: ?4 O( E$ F7 P* X$ i

& h* c1 D  Y: e& T4 w但是我照做之後
- I( r/ u/ g0 y# V0 q9 B不能連入相簿了1 h' H3 u% E8 M
他告訴我這行有誤& j; F0 u7 [4 D3 k8 B7 R9 a7 X
$sql = "SELECT user_id from `cpg134_users`  ...

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

3 D7 g8 x: Q: r* S9 F  p
说的太对了,赞同的赞同!!
  d  W' P  z6 RRagnarok power leveling
' V; r+ T9 i0 e) j1 y3 |ro power leveling9 O0 U$ u, v3 W9 h3 Z3 l$ _2 R
Ragnarok Online power leveling
& H# G5 P9 q# M5 J2 _: U7 h有事者,事竟成;) o+ ^  N9 h/ d
破釜沉舟,百二秦关终归楚;
% J% H( L  P3 ^8 g+ L5 ?' i苦心人,天不负;
$ F% s" Z, z; x. X6 j( Y7 ]卧薪尝胆,三千越甲可吞吴。
作者: fack10    時間: 2010-3-13 12:56 PM     標題: 支持!

支持!  i( D& ^( }( y2 p' L

/ P/ h" Q$ j* {$ l3 t. _% X! F/ s2 G$ t$ @
3 s$ ^# _: `, G

8 F9 T; }1 T! P9 {5 _- k+ j* \4 s
$ K0 R+ K/ n- P% t8 D7 m) Q: g. i% |9 n3 d) d
/ c! |' h) e+ u( E0 Q
! `- p8 L1 v* U! r  z6 C
* S) r' {( Y# y0 b4 k8 A) m! s& W

' j: |8 i5 {4 {# N7 l6 h9 n/ J' C+ \6 S
" Z# c% _& a$ p2 M
! y2 Y6 m$ V+ T; x+ T8 J
高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管
作者: fack10    時間: 2010-4-23 11:44 PM     標題: 支持!

支持!( U# v' D% k1 F8 L# s. b
1 s, J, c- S# `  @8 e: C; Q( Q

3 N* z! W- y' X% j9 Q
. E" A$ P7 v* n4 Z8 u  ^* S+ a4 J8 W& U# f& U

# t# T) c; Q; z$ d' {6 E3 u& ?8 G& Y% L" ?  {2 |

1 \: C: ~7 K3 ^% X0 j  I; Z4 v( k: D4 [' m7 p/ q' `8 {# G

3 f* o- d0 h8 p: y& _2 ?
5 ^& {- Y7 y( M! ~; Y/ I0 o+ M7 m. u1 o) W' b' ?
, `3 _- S2 Y9 J" c, t8 h8 O
9 }" v, p& n8 K2 F
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管




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