自己写了一个mvc 但是有的hosting无法通过 htaccess 正常隐藏 index.php 或 index.php?arg=, 下面找到了答案:
# Turn on URL rewriting
RewriteEngine On
# Installation directory 如果你的项目在非根目录的话,就填目录名,比如:/test/
RewriteBase /DIR_HERE/
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]
# or
#RewriteRule .* index.php?arg=$0 [PT,L]
以上代码写到 .htaccess 文件,并放置项目根目录下
分享到:
相关推荐
参考Zend Skeleton Application( )目录结构,此存储库中的.htaccess和index.php应放置在主项目文件夹中,而.htaccess和index.php则应存储在主项目文件夹中。公共/子文件夹应删除。 http://example.com/skeleton...
Apache的Mode Rewrite模块和.htaccess文件配合.docx
ThinkPHP 作为 PHP 框架,是单一入口的,那么其原始的 URL 便不是那么友好。但 ThinkPHP 提供了各种机制来定制需要的 URL 格式,配合 Apache .htaccess 文件,更是可以定制出人性化的更利于 SEO 的 URL 地址来。
Apache Web服务器.htaccess文件配置.docx
IIS 7及IIS 7.5下面.htaccess转为web.config的方法.docx
对于那些,web开发的来说,header头部和left...当然把我这个.htaccess文件下载后放在html同级目录下即可在不改变html后缀的情况下,也可以在html文件写PHP代码了.例如<?php require_once './public/header.html'; ?>
想要达成的效果很简单,我有两个模块,Home、Wechat。...隐藏index.php,这个比较简单,我开启.htaccess的支持就行,具体配置执行百度吧,我用的是apache2,建立一个软连接就成 ln -s /etc/apache2/mods-available
.htaccess伪静态 适用方维分享系统以及其他php
秉承MVC架构的思想,CI中的所有控制器都需要经过单点入口文件index.php(默认)来加载调用。也就是说,在默认情况下,所有CI开发项目的URL都形如以下这种形式: ...
文件上传之htaccess上传攻击
nginx没有开启.htaccess文件的支持 如果要规则要写在E:\server\nginx\conf\nginx.conf文件中 修改完成规则测试网站各个功能是否齐全 然后重启nginx E:\server目录下 nginx_stop.cmd \\停止文件 nginx_start.cmd \...
Slimore 是一个基于 Slim 框架的完全 (H)MVC 框架。它封装多种常用的组件,可以更加方便的进行 Web 应用的开发。主要特性:完全 MVC,支持多模块应用;集成了 Laravel Eloquent ORM / Model;自带多种常用的组件...
今天小编就为大家分享一篇laravel5.0在linux下解决.htaccess无效和去除index.php的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
apache开启.htaccess及.htaccess的使用方法.docx
如何让IIS支持Apache .htaccess 伪静态规则 ? 很简单,一键安装覆盖即可,内含说明步骤与安装包。
............................\.htaccess ............................\aboutnexus.php ............................\adduser.php ............................\admanage.php ............................\...
ThinkPHP的去除URL中的index.php的.htaccess文件
rewrite ^/index.html$ /index.php;rewrite ^/about.html$ /about.php;rewrite ^/search.html$ /search.php;rewrite ^/ranking.html$ /ranking.php;rewrite ^/apply.html$ /apply.php;rewrite ^/404.html$ /404.php;...