为网站创建htaccess

问题描述:

这是什么?为网站创建htaccess

转换:

http://name.com/pro/weblog/index.php?rayan_cat=23&rayan_cat_in=25

到:

http://name.com/pro/weblog/23/25/

如果index.php文件的时候还不知道

这就是所谓的URL重写。请参阅:http://httpd.apache.org/docs/current/mod/mod_rewrite.html

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^http://Yoururl/ 
RewriteRule (.*) http://yoururl//$1 [R=301,L] 


RewriteEngine On 
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)$ index.php?rayan_cat=$1&rayan_cat_in=$2 
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/$ index.php?rayan_cat=$1&rayan_cat_in=$2 

更换您的URL和文件的.htaccess保存在根文件夹

现在使用GET方法可以获取参数值。

+0

if index.php时间未知 – saeed 2011-03-10 10:40:19