的.htaccess添加一个额外的单词添加所有我的网址 [英] .htaccess add an extra word to add all my URLs

查看:129
本文介绍了的.htaccess添加一个额外的单词添加所有我的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个右后我的域名给我所有的网站的网址添加额外的字。

I need to a add a extra word right after my domain name to all my website URLs.

比方说我的网址是 http://www.example.com/somecategory/someproduct.html 时,它应该是 http://www.example.com/logado/somecategory /someproduct.html

Lets say my url is http://www.example.com/somecategory/someproduct.html, it should be http://www.example.com/logado/somecategory/someproduct.html.

是否有可能使用.htaccess文件做呢?

Is it possible to do it with .htaccess file ?

如果这样,我应该怎么添加到我的.htaccess文件?

If so what should i add to my .htaccess file ?

推荐答案

您可以在 DOCUMENT_ROOT /的.htaccess 文件中使用此code:

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On
RewriteBase /

# prefix each URL by /logado/ if it is not present
RewriteCond %{THE_REQUEST} !\s/+logado/ [NC]
RewriteRule ^ logado%{REQUEST_URI} [R=302,L,NE]

# internally remove /logado/ from all URLs
RewriteRule ^logado/(.*)$ $1 [L,NC]

这篇关于的.htaccess添加一个额外的单词添加所有我的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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