htaccess的URL重定向到测试的子文件夹,同时采用友好的URL重写重写、文件夹、重定向、友好

由网友(孤傲大全)分享简介:您好我有以下的重定向一个友好的URL网站Hi I have the following redirection for a friendly URL siteOptions +FollowSymLinks -MultiviewsRewriteEngine onRew...

您好我有以下的重定向一个友好的URL网站

Hi I have the following redirection for a friendly URL site

<IfModule mod_rewrite.c>

Options +FollowSymLinks -Multiviews

RewriteEngine on
RewriteBase /

RewriteRule ^$ /beta/ [L] // Got this from a fellow user in SO but didn't worked
RewriteRule ^home index.php
RewriteRule ^noticia/([w-]+)/?$ noticia.php?title=$1 [L,QSA,NC]
RewriteRule ^busqueda/([w-]+)/?$ busqueda.php?item=$1 [L,QSA,NC]
RewriteRule ^producto/([w-]+)/?$ producto.php?item=$1 [L,QSA,NC]
RewriteRule ^noticias/page/([w-]+)/?$ noticias.php?query=$1&page=$2 [L,QSA,NC]
RewriteRule ^noticias/tag/([w-]+)/?$ noticias.php?query=$1&keyword=$2 [L,QSA,NC]
RewriteRule ^noticias/search/([w-]+)/?$ noticias.php?query=$1&keyword=$2 [L,QSA,NC]


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]


</IfModule>

下面是链接到我的网站

网站

我想,当一个用户进入权到该地址,被重定向到一个测试版文件中的一个子文件夹

I want that, when an user goes right to that address, gets redirected to a Beta file in a subfolder

重定向

我至今无法正常工作。

推荐答案

试试这个:

Options +FollowSymLinks -Multiviews    
RewriteEngine on
RewriteBase /

RewriteRule ^/?$ /beta/ [L,R]

RewriteRule ^home index.php [L]
RewriteRule ^noticia/([w-]+)/?$ noticia.php?title=$1 [L,QSA,NC]
RewriteRule ^busqueda/([w-]+)/?$ busqueda.php?item=$1 [L,QSA,NC]
RewriteRule ^producto/([w-]+)/?$ producto.php?item=$1 [L,QSA,NC]
RewriteRule ^noticias/page/([w-]+)/?$ noticias.php?query=$1&page=$2 [L,QSA,NC]
RewriteRule ^noticias/tag/([w-]+)/?$ noticias.php?query=$1&keyword=$2 [L,QSA,NC]
RewriteRule ^noticias/search/([w-]+)/?$ noticias.php?query=$1&keyword=$2 [L,QSA,NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
阅读全文

相关推荐

最新文章