duanbi7247
2013-06-15 20:14
浏览 31
已采纳

Url重写执行重定向而不是源映射

I installed a wordpress on a server and put it under the folder apps/wordpress/.

What I want to do is the make the wordpress available using te url http://mydomain.com/blog instead of the url http://mydomain.com/apps/wordpress

In order to do that I wrote a .htaccess file that I put at the root of my server. Here is the file :

RewriteEngine    on
RewriteBase      /
RewriteRule      ^blog$    blog/  [PT]
RewriteRule      ^blog     /app/wordpress  [PT]

The problem is that instead of giving me the content of apps/wordpress, the browser receive a 301 and then redirect to apps/wordress. What I want to do is to hide the apps/wordpress url behind /blog not doing a redirect.

Any ideas how to do this ?

图片转代码服务由CSDN问答提供 功能建议

我在服务器上安装了wordpress并将其放在apps / wordpress /文件夹下。

我想要做的是使用网址 http://mydomain.com/blog <使Wordpress可用 / a>而不是网址 http://mydomain.com/apps/wordpress \ n

为了做到这一点,我写了一个.htaccess文件,我把它放在服务器的根目录下。 这是文件:

  RewriteEngine on 
RewriteBase / 
RewriteRule ^ blog $ blog / [PT] 
RewriteRule ^ blog / app / wordpress [PT] 
   
 
 

问题在于,浏览器不会向我提供apps / wordpress的内容,而是接收301然后重定向到apps / wordress。 我想要做的是隐藏/ blog后面的apps / wordpress url没有做重定向。

任何想法如何做到这一点?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douzhu1188 2013-06-16 18:46
    已采纳

    Ok I don't know why, but this is working:

    RewriteRule ^blog$ blog/
    RewriteRule ^blog/(.*) /apps/wordpress/$1
    

    Doesn't matter, it's working now :)

    评论
    解决 无用
    打赏 举报
  • 查看更多回答(1条)

相关推荐 更多相似问题