2011-02-12 137 views
0
http://www.example.com/justridesbeta/jstride/vehicle 

使用htaccess的重寫PHP網址使用的htaccess

http://www.example.com/justridesbeta/addride 

目前使用

<IfModule mod_rewrite.c> 
    Options +FollowSymLinks 
    RewriteEngine On 

    # Get rid of index.php 
    RewriteCond %{REQUEST_URI} /index\.php 
    RewriteRule (.*) index.php?rewrite=2 [L,QSA] 

    # Rewrite all directory-looking urls 
    RewriteCond %{REQUEST_URI} /$ 
    RewriteRule (.*) index.php?rewrite=1 [L,QSA] 

    # Try to route missing files 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} public\/ [OR] 
    RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$ 
    RewriteRule . - [L] 

    # If the file doesn't exist, rewrite to index 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA] 



    RewriteRule ^[a-zA-Z0-9]+$ justridesbeta/jstride/vehicle 
    </IfModule> 

回答

0
if ($_SERVER['REQUEST_URI'] == '/justridesbeta/jstride/vehicle') 
{ 
    header("Location: http://www.example.com/justridesbeta/addride"); 
    exit; 
} 

如果你真的需要一個

+0

outputing爲嚴重的錯誤,是分號';' – Daric 2011-02-12 08:01:24