301重定向不工作,是我想要的可能吗?(301 redirect not working , is what I want possible)

   IT问题网   2018-02-26 00:00:00

问 题

下面是我的.htaccess文件

 #begin字press
 ifmodule mod_rewrite.c
rewriteengine叙述上
的rewritebase /
重写规则^指数\ .php $-[l]
的rewritecond%{} request_filename!-f
的rewritecond%{} request_filename!-d
重写规则。的index.php [l]
 / ifmodule
#结束字press

重定向301 http://whattodoindublin.com/ http://www.whattododirectory.com/category/dublin/
 

http://whattodoindublin.com/ 是指向同一个文件夹中的 http://www.whattododirectory.com/ 所以它加载同样的内容,但我想要的 http://whattodoindublin.com/ 加载子目录上面,这可能吗?

解决方案

从的重定向指令

语法:重定向[状态] url路径url
...
旧的url路径是区分大小写的(%-de coded)路径的用斜线开始。相对路径是不允许的。

您只能重定向的路径的一个外部url。也许在你的虚拟主机部分还是在的.htaccess的whattodoindublin.com,你可以做

 重定向301 / http://www.whattododirectory.com/category/dublin/
 

标签:定向工作想要可能



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

从Zend框架的URL删除的index.php(remove index.php from zend framework url)

problem i am developing a module using zend framework and ...

htaccess的非www到www 301(.htaccess non-www to www 301)

problem i redirected non-www request to www through .htac ...

从内部URL获取数据(Get data from within URL)

problem on my website, say test.com, if someo ...

如何使用$ _GET参数,使搜索引擎友好的URL?(How to use $_GET parameter to make seo friendly urls)

problem i am using a php cms that i've made myself. it fe ...

无尽的重定向循环通过htaccess的规则多国语言(Endless Redirect Loop by htaccess rules multi language)

problem i'm not good in writing modrewrite access rules a ...

从重定向到login.aspx的prevent ASP.NET(Prevent ASP.NET from redirecting to login.aspx)

problem we have a website that runs fully on angularjs wi ...

.htaccess中加入.html扩展名的网址有或没有结尾的斜线(htaccess add .html extension for urls with or without trailing slash)

problem so to begin with i have a custom url rewrite that ...

利用浏览器缓存和CakePHP(Leverage Browser Caching and CakePHP)

problem i asked my host if they supports mod_expires or n ...

从/ CH-德重定向的URL /到/德/,重定向的URL呢?并与放大器;(Redirecting URLs from /ch-de/ to /de/ and redirecting URLs with and &)

problem internet research didn't help me so i am desperat ...

webfont不apear加www(webfont does not apear without www)

problem i have tried to find the answer every ...

在Word preSS使用自定义重写规则(Using custom rewrite rules in Wordpress)

problem i am trying to create custom rewrite rules in wor ...

的.htaccess要求WWW的域名,但让子域,如果存在没有硬编码(.htaccess to require WWW for domain, but allow subdomain if existing with no hard coding)

problem i'm trying to figure it out how to se ...

子域名重定向请求子目录+ HTTPS(使用的.htaccess)(Redirect subdomain request to subdirectory + https (using .htaccess))

problem i've got some issues with a .htaccess ...

重写网址的index.php,但要避免在URL中的index.php(Rewrite URL to index.php but avoid index.php in the URL)

problem i'm trying to internally redirect all requests to ...

在.htaccess中使用自定义的环境变量(Using custom environment variables in .htaccess)

problem i need something like this: setenv foo bar.baz r ...

codeigniter 2 htaccess的路由差异(codeigniter 2 htaccess routing differences)

problem codeigniter v2.0 that was released on the 28th. i ...

阿帕奇的.htaccess:我如何重定向文件是不是没有发送404头发现了什么?(Apache .htaccess: How do I redirect for files that aren't found without sending a 404 header)

problem my website needs a htaccess file that will redire ...

htaccess的重写替换空间 - (htaccess rewrite replace space with -)

problem i am really stuck on a rewrite rule a ...

URL重写 - 查询字符串(URL Rewrite - Query String)

problem i have a news (blog) site that returns urls in th ...

隐藏扩展名在.htaccess(Hide extension in .htaccess)

problem hi all i have a problem that my file have .html e ...