从的.htaccess重定向URL重写/地图 [英] Redirect URL Rewrite/Map from .htaccess

查看:134
本文介绍了从的.htaccess重定向URL重写/地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是,
我想我的口目前的网站是在codeIgniter到Word preSS建成。我不想伤害我的谷歌排名,并对于这一点,我真的需要某些URL映射到现有的文件和新的URL,我会让字preSS处理它在默认方式。该发生的主要问题是,我不希望改变现有的域。我想重定向/在同一个域中的文件从我现有的codeIgniter项目映射。

The problem is, I want to port my current website which is built upon CodeIgniter to WordPress. I do not want to hurt my google ranking and for that, I really need to map certain URLs to an existing file and for new URLs, I will let WordPress handle it in the default way. The main problem that arises is that I do not wish to change the existing domain. I want to redirect/map the files on the same domain from my existing CodeIgniter project.

好吧,让我对于这问题,我的状态多一点清晰。我复制了我现有的codeIgniter项目到Word preSS根文件夹。现在,我将让从我的codeIgniter项目提供服务的旧的URL并全部换新,我将让字preSS处理。我也会端口现有数据库到新的服务器并创建单词preSS安装一个单独的。
那么,如何将我的旧网址映射到codeIgniter?

Okay, let me make it a bit more clear about the state of my problem. I copied my existing CodeIgniter project into the WordPress root folder. Now, I will let the old URL being served from my CodeIgniter project and for all the new ones I will let WordPress handle it. I will also port the existing database to the new server and create a separate one for the WordPress installation. So, how can I map my old URLs to the CodeIgniter?

我的旧网址看起来像这样,

My old URLs looks something like this,

http://www.example.com/site/blog/123/abc-xyz-wxy

我要处理来自codeIgniter文件,将由字preSS创建将字preSS来处理新URL,URL,这些这将是这样的,

I want to handle these URL from CodeIgniter file and the new URLs that will be created by WordPress will be handled by WordPress which would look like this,

http://www.example.com/abc-xyz-wxy

所以,到目前为止,这是我的.htaccess文件的样子,

So, far this is how my .htaccess file looks like,

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/wordpress/
RewriteRule ^site/blog/([0-9]+)/([a-zA-Z0-9-]+)/?$ codeignitor/index.php/$2 
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cms/wordpress/index.php [L]
</IfModule>

结束字preSS

和这件事的工作绝对没问题,但我想更多的是URL掩蔽。我想消除从URL codeIgnitor文件夹名称。

END WordPress

And this thing works absolutely fine, but what I want is more of a URL masking. I want to eliminate the CodeIgnitor folder name from the URL.

推荐答案

有关选择ABC-XYZ-WXY的字符串和重定向,请尝试使用:

For selecting the "abc-xyz-wxy" string and redirecting, try using:

RewriteCond %{REQUEST_FILE} !-f
RewriteCond %{REQUEST_FILE} !-d
RewriteRule ^site\/blog\/123\/([a-z-]+) index.php\/$1 [NC,L] ^$1

免责声明:没用过codeIgniter,所以大家随时纠正

Disclaimer: Never used CodeIgniter, so everyone feel free to correct.

这篇关于从的.htaccess重定向URL重写/地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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