是的,我已阅读Apache手册并在此搜索.出于某种原因,我根本无法让这个工作.我最接近的是删除扩展名,但它指向根目录.我希望这只是在包含该.htaccess文件的目录中工作.
我需要对.htaccess文件做三件事.
我需要它来删除.php
一个.我有几个页面使用选项卡,URL看起来像page.php #tab - 这可能吗?
湾 我有一个页面使用附加到URL的会话ID,以确保您来自正确的地方,www.domain.com/download-software.php?abcdefg.
这可能吗?另外,在执行此操作时,是否需要从头文件导航包含文件中的链接中删除".php"?应该IE "<a href="support.php">support</a>" be <a href="support">support</a>?
domain.com,但是www.domain.com/page.我会继续寻找,尝试等等.会在子目录中导致任何问题吗?
我想在我的.htaccess文件中添加一些内容来隐藏.php我的php文件的文件扩展名,所以访问www.example.com/dir/somepage会向他们展示www.example.com/dir/somepage.php.
这有什么工作解决方案吗?我的网站使用HTTPS,如果这很重要的话.
这是我目前的.htaccess:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
ErrorDocument 404 /error/404.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
Run Code Online (Sandbox Code Playgroud) Ubuntu 14.04LTS 32bit
灯
我知道这是一个老问题,但..
我需要它从可见网址中找到它的任何地方删除.php.它需要使用/showthread.php?id=XX --->/showthread?id = XX
我甚至无法与它合作/page.php- > /page.我试过这些:
如何使用Apache mod_rewrite隐藏.html扩展名
它什么都不做.而其他.htaccess代码工作正常..
而
<?php
phpinfo();
Run Code Online (Sandbox Code Playgroud)
列出已加载模块中的mod_rewrite
和
<?php
if(!function_exists('apache_get_modules') ){ phpinfo(); exit; }
$res = 'Module Unavailable';
if(in_array('mod_rewrite',apache_get_modules()))
$res = 'Module Available';
?>
<html>
<head>
<body>
<p><?php echo apache_get_version(),"</p><p>mod_rewrite $res"; ?></p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
返回 Module Available
尝试了更多的东西
# Apache Rewrite Rules
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# Add trailing slash to url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond …Run Code Online (Sandbox Code Playgroud) 如何在不创建新目录并命名文件index.php的情况下从网页中删除文件类型.我想http://example.com/google.html访问http://example.com/google.
我该怎么做呢
PS:我试过看一些其他的教程,但那里令人困惑.我现在可以在.htaccess中完成它
我想将我的URL设为SEO友好URL.我尝试通过重写规则来编辑.htaccess文件
RewriteRule ^swift-details/([0-9]+)/([0-9a-zA-Z_-]+)$ swift-details.php?id=$1 [NC,L]
RewriteRule ^swift-details/(css|js|img)/(.*)?$ /$1/$2 [L,QSA,R=301]
Run Code Online (Sandbox Code Playgroud)
它正在路由正确的URL但在该页面中CSS JS和图像不起作用.
示例网址:
我可以在那个网站上看到网址是http://stackoverflow.com/questions/ask.之后没有文件扩展名,如果ask是一个文件夹,并且在index.aspx内部,它看起来就像http://stackoverflow.com/questions/ask/.
他们是怎么做到的?他们如何使扩展消失?谢谢,幻影