【问题标题】:how can I remove folder name from url in php? [duplicate]如何从 php 中的 url 中删除文件夹名称? [复制]
【发布时间】:2017-03-05 21:28:56
【问题描述】:

我已经创建了 index.php 文件并给出了标题,即

<?php

header('location:/cicareer/members');

?>

网址是:

careermate.in/cicareer/members

我要删除

/cicareer/members

那么,我如何使用.htaccess 文件来做到这一点?

【问题讨论】:

  • 可以使用explode命令 --> $url = "careermate.in/cicareer/members"; $pieces = explode("/", $url);回声 $pieces[0]; --> 这应该与 careermate.in 相呼应

标签: php html .htaccess


【解决方案1】:

这一行可能对您的 .htaccess 文件有所帮助

RewriteRule ^index.php$ /cicareer/members/index.php

为了使用它,您需要在 httpd.conf 中启用 mod_rewrite 模块

【讨论】:

    猜你喜欢
    • 2020-03-19
    • 2014-04-22
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 2013-09-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多