我的网站运行一个名为 - > WSS壁纸脚本的脚本
我的问题 - >我一直在尝试强制删除或在我的URL末尾添加尾部斜杠以防止重复内容并清理我的URL.
我已经尝试了各种各样的尝试,并尝试了我能想到的一切,并从互联网上加载,但没有这样的运气!这可能是一个快速修复,但我已经看了很多,我可能对死明显的东西视而不见.
所以我告诉你我所有的.htaccess代码:
DirectoryIndex index.php
RewriteEngine on
RewriteRule ^download/([0-9]+)?/([0-9]+)x([0-9]+)/([^/\.]+) image.php?id=$1&width=$2&height=$3&cropratio=$4&download=1 [L]
RewriteRule ^file/([0-9]+)?/([0-9]+)x([0-9]+)/([^/\.]+) image.php?id=$1&width=$2&height=$3&cropratio=$4 [L]
RewriteRule ^preview/([0-9]+)?/([0-9]+)x([0-9]+)/([^/\.]+) wallpaper_preview.php?id=$1&width=$2&height=$3&name=$4 [L]
RewriteRule ^thumbnail/([0-9]+)?/([0-9]+)x([0-9]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/]+) image.php?wallpaper_id=$1&width=$2&height=$3&cropratio=$4&align=$5&valign=$6&file=$7 [L]
RewriteRule ^cat/([0-9]+)?/([^/\.]+)/p([0-9]+) index.php?task=category&id=$1&name=$2&page=$3 [L]
RewriteRule ^cat/([0-9]+)?/([^/\.]+)/([0-9a-zA-Z?-]+)/p([0-9]+) index.php?task=category&id=$1&name=$2&sortby=$3&page=$4 [L]
RewriteRule ^cat/([0-9]+)?/([^/\.]+)/([0-9a-zA-Z?-]+)-([0-9]+) index.php?task=category&id=$1&sortby=$3&page=$4 [L]
RewriteRule ^cat/([0-9]+)?/([^/\.]+) index.php?task=category&id=$1&name=$2 [L]
RewriteRule ^tag/([^/\.]+)/([0-9a-zA-Z?-]+)/([0-9]+) index.php?task=tag&t=$1&sortby=$2&page=$3 [L]
RewriteRule ^tag/([^/\.]+) index.php?task=tag&t=$1 [L]
RewriteRule ^profile/([0-9]+)?/([^/\.]+) index.php?task=profile&id=$1&name=$2 [L]
RewriteRule ^profile/comments/([0-9]+)?/([^/\.]+) index.php?task=users_comments&id=$1&name=$2 [L]
RewriteRule ^page/([0-9]+) index.php?task=view_page&id=$1 [L]
RewriteRule ^register index.php?task=register [L]
RewriteRule ^lost-password index.php?task=lost_pass [L]
RewriteRule ^links index.php?task=links [L]
RewriteRule …Run Code Online (Sandbox Code Playgroud) 我正在设计一个网站.我希望我的网站地址如下图所示:

我不希望我的网站看起来像http://something.com/profile.phphttp://something.com/profile.php当有人打开我的网站时,
我希望在地址栏中删除扩展名.换句话说,我希望我的网站像:http://something.com/profile
作为第二个示例,您可以查看StackOverflow网站本身.
有人可以帮助我完成这项工作吗?谢谢!
我有一些静态网站,我只想隐藏.html扩展名:
/foo获取静态文件/foo.html/foo然后客户端可以发送风格的书签mydomain.com/foo而不是mydomain.com/foo.html.
这听起来非常简单,mod_rewrite之前我曾经愉快地使用过(比如使用WordPress或重定向),但事实证明这更难破解.也许我错过了一些非常明显的东西,但我无法在任何地方找到解决方案而且我整天都在这里!
我们运行自己的服务器,所以这可以去哪里是最好的地方.
附录
下面检查的解决方案工作正常.然后在运行该网站一段时间后,我注意到两个问题:
所有页面都开始显得格格不入.我重新加载,清除缓存等,但仍然没有风格.我以前遇到过这个麻烦,找不到来源.
有一个目录和一个名为'gallery'的html文件,因此/ gallery链接显示了一个目录列表而不是html文件.我应该可以排序那个,但欢迎进一步提示:-)
可能重复:
使用.htaccess删除.php扩展名
我试图隐藏.php文件扩展名但由于某种原因无法使其工作.我最近的尝试如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^folder/([a-zA-Z_\-0-9]+)/?$ /folder/$1.php
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我尝试了很多不同的代码差异我在网上找到但仍然没有运气..htaccess文件位于根目录中.
可能重复:
使用.htaccess删除.php扩展名
我想将我的所有网站url myurl/webpageexamples.php重命名为非扩展版myurl/webpageexamples -if可能在htaccess-并同时将所有流量从myurl/webpageexamples.php重定向到新的myurl/webpageexamples.
我发现有几个从PHP重定向到非PHP像:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]
Run Code Online (Sandbox Code Playgroud)
我有什么:myurl/webpageexamples.php
我想要的:将搜索引擎优化得分的myurl/webpageexamples转移到新的myurl/webpageexamples
谢谢
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中完成它
我试图从我的PHP页面中删除扩展名,例如www.mywebsite.com/verification.php,我希望人们能够从中进行验证
www.mywebsite.com/verification
我的代码:
<?php session_start(); ?>
!DOCTYPE html
html lang="en"
head>
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
Run Code Online (Sandbox Code Playgroud) 可能重复:
使用.htaccess删除.php扩展名
我有
http://www.example.com/test/categoryform.php
Run Code Online (Sandbox Code Playgroud)
在我的.htaccess文件中,如何重写它以显示为:
http://www.example.com/test/categoryform/
Run Code Online (Sandbox Code Playgroud) 网站来源:http : //www.salesfee.com/
我的网站上有一个职业部分,它重定向到 http://www.salefee.com/index2.html
我希望我的网址看起来像http://www.salefee.com/career. .html我的网址后不希望有任何后缀。我已经使用www.godaddy.com
有人可以帮我写代码吗?该网站是在 html/css 中制作的。提前致谢!!
.htaccess ×7
php ×6
mod-rewrite ×4
apache ×3
html ×3
friendly-url ×2
rewrite ×2
url ×2
custom-url ×1
redirect ×1