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

网站重定向问题

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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 已知许多点位,想通过高斯分布来随机选择固定数量的点位怎么改
  • ¥15 怎么生成确定数目的泊松点过程
  • ¥15 layui数据表格多次重载的数据覆盖问题
  • ¥15 python点云生成mesh精度不够怎么办
  • ¥15 QT C++ 鼠标键盘通信
  • ¥15 改进Yolov8时添加的注意力模块在task.py里检测不到
  • ¥50 高维数据处理方法求指导
  • ¥100 数字取证课程 关于FAT文件系统的操作
  • ¥15 如何使用js实现打印时每页设置统一的标题
  • ¥15 安装TIA PortalV15.1报错