我在顶层与其他文件的index.php文件,如一个名为包含文件夹的login.php,register.php。文件夹层次结构是这样的:
I have an index.php file in the top level with other files such as "login.php", "register.php" in a folder called includes. The folder hierarchy looks like this:
index.php
includes/
register.php
login.php
css/
style.css
images/
image.png
如何设置链接直接像 http://www.mydomain.com/register 然后从index.php页面调用(包括)的register.php页面?
How can I set the url to something like http://www.mydomain.com/register which then from within the index.php page calls (includes) the register.php page?
这是去了解它的最好方法是什么?
Is this the best way to go about it?
感谢
迈克
如果你的服务器是Apache的: 创建于根文件夹中的文件。htaccess的
If your server is Apache: Create on root folder file ".htaccess"
#.htaccess
RewriteEngine On
Options +FollowSymlinks
RewriteRule /register index.php?mode=register
//的index.php
//index.php
<?php
if(isset($_GET['mode']=='register')){
include('includes/register.php');
}
?>