doudao1950
2013-04-12 16:25
浏览 22
已采纳

网站重定向问题

I have been working on a website that is primarily PHP based. When a user visits the site stuff like http://robroscoe.ca/index.php, is redirected to http://robroscoe.ca and I am okay with this. What I am not okay with is, my webpages like robroscoe.ca/cv.php when you type in robroscoe.ca/cv redirecting back to robroscoe.ca. I am not sure how this happened and I am wondering if someone could explain to me what is going on.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I think the .htaccess file has something to do with this but I am not sure how to modify this as Wordpress seems to have created this for me without me knowing it. Any help or reading materials would be appreciated.

Thanks for your time!

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

1条回答 默认 最新

  • duanchu3376 2013-04-12 16:49
    已采纳

    You problem is that you've created a PHP script that is separate from WordPress and are trying to access it through a 'pretty' URL which WordPress handles. WordPress does not know of a page called 'cv', and handles it like any other 404.

    I would strongly recommend that you create the page within WP so it can manage its own 'pretty URL' structure.

    If you're hellbent on shoehorning your own scripts in, then get cozy with hand-editing your .htaccess file for each one.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^cv/?$ cv.php [L]   #new rule
    RewriteRule ^index\.php$ - [L]  #this is made redundant by the very next line.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题