打印

[CPG] 精簡網址

[CPG] 精簡網址

基本上就是讓
  F- w% j' L& ?6 }( M3 l
* V) z7 X' }* h2 Lhttp://pic.segaa.net/segaa: y& V. A; G, q) Q
& k# c% [! z4 L+ O# L) X
自動相通於' {% x4 T2 q( Z5 R  A5 |4 ~0 k

4 l* a8 O8 U, c1 Q! x* V7 U* Ghttp://pic.segaa.net/index.php?cat=100022 o: f8 j, P4 H8 f/ H+ b

" t8 B* Q* Q  k; Z+ M0 f; B讓使用者簡單的記住自己相簿的網址 6 ]/ m' m/ t4 H$ Q

% ?& U7 }4 F  g+ h編輯index.php 加入以下這些% E. e- \9 ^6 ?; P  @+ ]
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 M( v  T$ ]! _! b  U' }8 l9 j; j5 p3 B9 I! S2 J3 f

* i) [! f1 N1 S% X" R/ D1. 登入管理者之後 -> 設定 -> 允許外掛  點 是 -> 確認
3 G5 r, m, p  L: `9 F/ F/ W7 [6 V+ R8 o6 a' q- s3 b" R, E
2. 設定 -> ( 外掛管理 ) -> 名稱 Search Engine Friendly URLs v1.0 -> 旁邊有一個 i 的圖形點下去+ C  Z/ C' r& U$ p* \
    選擇覆蓋掉原本的 .htaccess 檔 ' S- S4 G. U& H
+ q  W8 X+ Z9 i+ S' U
3. 但是這樣作會讓之前的 http://pic.segaa.net/segaa 失效 , 所以再把上篇的內容加回去
  V. B; d4 e. _$ \; \3 x4 Y& B+ Y9 p6 b1 y0 o- \# v) K  _3 F( O
下面是我目前的 .htaccess 檔 / ^- I) s! o1 x/ S+ {, |
3 d' K' N, Z! j( O$ L* 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

TOP

其實關於精簡網址
# u: Y$ B1 o- Z6 O! B: Z6 o4 n這邊站長的教學寫的很清楚了2 f: W  t3 s; e% ~
謝謝
7 C" \, V* E; g* B/ ^  s# q- H1 @8 Y7 ~
但是我照做之後! Z$ ?$ h+ b+ w. D0 f% o1 J2 G0 j
不能連入相簿了0 |! X) E/ D* D4 W/ k' g
他告訴我這行有誤
5 d" l! U: l- i/ {; [$sql = "SELECT user_id from `cpg134_users` WHERE `user_name` = "$qq"";
/ P/ A+ K. }+ i/ y5 Y(上面的cpg134_users我改成cpg1410_users)! f4 R  S9 b7 i3 I
: s6 A& e4 a9 Y
請問一下我該如何解決?
% `5 }5 V" F, w謝謝

TOP

sorry 太少上論壇看東西了
5 R5 `$ e! H4 s2 F% s這邊原本是我用來丟些文件用的
+ l8 i+ n3 A. K, ]- p關於這個問題,可能你要直接進資料庫,看你資料庫中所使用的欄位名稱+ S$ j3 f" h) E; u/ K" J  {

$ F7 n; K5 m0 e$ l+ G& A9 O) y/ h# a: J; e
引用:
原帖由 prolog 於 2006-11-21 02:46 PM 發表
4 k5 d9 l$ u, s% V+ h其實關於精簡網址
5 ^/ _0 o. X8 [這邊站長的教學寫的很清楚了; B- A7 K% h/ l) ^5 P; K; q
謝謝
) U& q1 p, y# [" `8 Q' F' f& H1 o' R0 k6 n' r* ?& Q1 O3 U7 l
但是我照做之後
( `" V+ t" U) F) F* a* T1 C不能連入相簿了
2 b4 H0 t) H8 t/ ~9 V他告訴我這行有誤; h: Y9 b/ y$ c' J, v9 R; x) @
$sql = "SELECT user_id from `cpg134_users`  ...

TOP

Ragnarok Online usrmt power leveling

5 S8 x% Y( C& |% Z; d8 K
说的太对了,赞同的赞同!!# D6 O5 ^* ^" L9 T0 p
Ragnarok power leveling
  a# W/ {) w, Lro power leveling& d( S4 g9 I( \5 v% |  a
Ragnarok Online power leveling% Q3 F7 g! ~  T: Q% e' ?( H. t! {
有事者,事竟成;% J! ^. n3 u7 O2 i3 Z4 F2 @. g
破釜沉舟,百二秦关终归楚;
" ?8 r( _2 ?7 u- F  q2 O苦心人,天不负;1 h# `/ t3 v, U! ~6 f4 i
卧薪尝胆,三千越甲可吞吴。

TOP

支持!

支持!
( O  L8 A9 \# R' s; u0 w  R
6 Q. m+ U; p: R$ D2 ?2 f7 @7 ?3 s1 @# K

6 ~0 h  \& y6 Q8 a
- c6 L8 U7 N. i2 P2 s9 B9 ?2 i. A# O9 }6 T$ C4 B1 e8 d9 D0 v! G
0 k7 o# L6 U$ ^5 {8 ^) j* J2 L  i
5 @6 x; d3 Y, F! F! X. E% ?- d; R" g
, Q) Y  ?- {+ T5 Y- C$ P! E' A. ?

$ \; v! A3 Y: m: V# u
. C8 F/ f  z% D  s- F! i: n
0 |( ^* b2 B3 [* L/ ^1 o
- g" g7 W8 G2 y
$ N! ^# v: ?5 x高温合金管 12cr1mov合金管 不锈钢无缝管 大口径无缝管 高压合金管

TOP

支持!

支持!' h" o  N3 {2 h" ?( \! a

5 {; y# @% H. `% [" O, B6 w2 e+ r9 `4 i  K
: p8 P4 Q8 q/ Y9 F9 W

1 V% r, j& u/ N& \$ Q* `. v0 i! b  C/ f* V- _. q0 F

; z- x% M3 i3 R, c6 H1 p6 Z+ i- u1 d' N9 R
8 O6 J) R% C% i" d

4 R; `1 s! f3 h) s
- W' g2 i7 e4 z9 T9 d4 u
# L/ V- y% n$ F. W$ m- N( h2 u: f- y# p0 l
4 i( {; Y* F4 {7 Z5 a- [
A333GR3无缝钢管 无缝方矩管 S355无缝方管 热轧无缝方管 无缝方管

TOP

發新話題