打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
" L- `4 D9 x9 n$ H* ~- A; k  z2 s: |& [5 d) P( v9 |6 n
http://pic.segaa.net/segaa
9 p% a( l/ Y) c; W" m$ ]$ e: ?; S3 ^) q/ ?! p8 b7 u1 K2 O* o
自動相通於0 ], o  D# K+ S6 P2 z6 i
- H5 k' X* v( a4 o, [1 l1 Q
http://pic.segaa.net/index.php?cat=100021 p" x8 {% O3 V8 G+ M& B
' n3 H6 b1 V3 w5 W4 x) Z; {9 v. w
讓使用者簡單的記住自己相簿的網址 ; e( g) a( ^3 I( B$ `! u& G  `5 ?

; H; P. X! }5 c5 {編輯index.php 加入以下這些9 T! `9 S4 p! ]5 g# q# M/ L2 H0 q- A
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

進階的精簡網址 ... 基本上直接開啟外掛就好了 % K' _' U. F& h" D/ S
# _6 F( x/ `) ^" h/ ~" z4 S$ ?
9 L9 I& S$ `1 Q- X( L1 H
1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認 : b# y2 Y7 A4 A+ N! [4 ?  t  H

3 h" i$ w1 T0 v/ O. i$ _! ?2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去
% M- s. G8 ^. d+ M9 l( }    選擇覆蓋掉原本的 .htaccess 檔 ( _1 \& U6 ?4 U" Q# w% t
- y5 `, s# e* _
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去( @% ~' o$ d! a4 @6 ^- ^0 a: `

4 c5 _  l$ \! R3 l9 f+ U下面是我目前的 .htaccess 檔
' Q/ R- P) {% h6 P1 ~+ p# m* |
7 D" \6 M0 [( T5 Q2 O% Lps.我將 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

其實關於精簡網址) Q. J2 ]1 m$ J% K8 i
這邊站長的教學寫的很清楚了( F; K: ]$ \: r- }, I
謝謝. {/ H1 ?! I1 h" Y0 s
0 E( K" i7 a5 m; I7 y  F' r+ p
但是我照做之後: @) G1 H- Y; Y, r0 k
不能連入相簿了
7 k* W& Z1 @3 U5 q# P, B他告訴我這行有誤
: N  H7 P" q" t, }% N* }$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";) Z5 z: ]- e3 M2 m  M* `
(上面的cpg134_users我改成cpg1410_users)% x, w7 Q: i( X1 ]4 J) I

, e3 g, Q! X7 W$ g9 e* N8 |8 ]: J# L請問一下我該如何解決?
( N' \, i5 W4 l- y- `謝謝

TOP

sorry 太少上論壇看東西了
6 E; }  A$ U0 {! ^: _這邊原本是我用來丟些文件用的 ( |; S! @) N9 z! X
關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱
6 ?9 ?4 @! p$ S5 n. ~7 h1 F, @; a

& _9 F% V4 ?% z/ G1 \* l
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
, K. F  o8 G4 X& ]" M) |其實關於精簡網址( L4 T! T* H/ @; b# q/ `$ D* U* j
這邊站長的教學寫的很清楚了% }& g! ?' c% A9 b( U4 G- Y' W
謝謝
% ^  t, u0 G' m4 y4 a8 H" C3 B
但是我照做之後
( b. H4 h; e* c) ^不能連入相簿了: y1 G* \) f0 t5 N
他告訴我這行有誤+ |( j0 m0 p/ V6 a
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling


: p  @; ]  b  Q7 x0 T, d( c# p  m说的太对了,赞同的赞同!!
5 l2 R  p7 {& ~/ E! n2 Q  \Ragnarok power leveling- p* l# T8 E& p# Z, H* _
ro power leveling
% E# S. `4 A, U/ g0 W+ Y% _Ragnarok Online power leveling# X1 s% X& r& _& _
有事者,事竟成;
' U# [2 k" m9 F' K  A破釜沉舟,百二秦关终归楚;: l; L/ z6 U  b. P5 h& X
苦心人,天不负;: p3 k0 F4 t. l; w0 \, c
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!, P9 e8 x1 d: k8 J1 S  h2 s& T
% T8 B7 I( {" K1 D1 B" u; p* ~" T
! q* U4 K  m! f6 `0 y# E1 J: M1 S! W' a
. g" U& o- @" [) r' @

; Y; `3 m! n' s6 P2 o$ B0 s( X' c9 A% b$ }+ g2 X# F; s. j: }' ?  u

2 l' }# O9 _! L
) ]# _% h8 U7 J2 B) ?4 V  k% }! i2 n$ b2 K$ {# [8 H# ^

+ L) T3 O  b' Z+ l+ L1 g
- S$ z( j& f/ k7 e* X8 X( E) p
7 Q- M  i( `8 d, h0 b) C" c2 Y' P3 Q

6 x- T+ P) O, ]5 U6 x高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!
$ {  a" ?9 \6 o2 g/ s* h4 E+ R, V5 @( D) w8 o. E7 M

9 H) x/ y. L' U; |# m
7 \8 n  y' _4 P9 z6 L/ ]0 l$ y; S9 |$ o9 c0 |

; d  i  O4 @: m/ r8 s6 x
' O' c( v5 Y) @
' `! R; K8 \( e2 _; |* [- Y* Z  L5 @/ Z
3 n5 `* h4 Y( \; N* e
+ {, Y# H  {5 L6 @5 h5 r5 N
# N- }! J( t2 T# ~9 l2 W8 ~) q
3 ]" A7 o+ E% v

$ ^) J. j5 L6 K( o+ p: B# |: E( ^A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題