htaccess的URL重定向到测试的子文件夹,同时采用友好的URL重写 [英] htaccess URL redirect to beta subfolder, while using friendly URL rewrite

查看:133
本文介绍了htaccess的URL重定向到测试的子文件夹,同时采用友好的URL重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有以下的重定向一个友好的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]

这篇关于htaccess的URL重定向到测试的子文件夹,同时采用友好的URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆