我看到了许多问题被问及的.htaccess去除延伸,并发现一个由.htaccess文件使用该会删除扩展.php为:
I have seen many question been asked about the .htaccess removal of extension and have found one that removes the .php from the extension by using this in the .htaccess files:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
我的问题是,我的分机是我的域/主题/平/ index.php文件,并具有在.htaccess文件中只有它缩短到我的域/主题/平/索引和其他网页,如接触我们来看看像我的域/主题/平/接触。
My problem is that my extension is my-domain/themes/smooth/index.php and having that in the .htaccess file only shortens it to my-domain/themes/smooth/index and other pages like the contact us look like my-domain/themes/smooth/contact.
有什么办法具有扩展的中间取出,使其看起来更像是:
Is there any way of having the middle of the extension removed so that it look more like:
我的域/联系人
最好的问候和放大器;非常感谢
Best regards & many thanks
是的,有,但框架,如交响乐,codeigniter等将帮助你做到这一点。如果你想找一个简单的实现,那么你可以做的文件名重映射。
Yes, there is, but frameworks such as Symphony , codeigniter etc will help you do that. If your looking for a simple implementation, then you can do a remap of the file names.
$uri = trim($_SERVER['REQUEST_URI'], '/');
$pages = array(
'contact' => 'path to contactus.php',
'services' => ' path to services.php'
);
if ( in_array($uri, array_keys($pages))){
include $pages[$uri];
}
香港专业教育学院没有测试code。总之你有一个的index.php页面,该页面包含其他页面。
Ive not tested this code. In summary you have an index.php page and that page includes other pages.