嗯我的.htaccess有问题,我想改写一下:
http://domain.com/a/thread-103518.html#103518
对此
http://domain.com/a/103518
换句话说......我想删除“thread-”和“ . ”之后的所有内容 . / a /必须是变量的...还有/ bla /和/ code /的其他论坛
你有线索吗?谢谢
我的.htaccess现在:
RewriteCond%!-d RewriteCond% .php -f RewriteRule ^( . *)$ $ 1.php RewriteCond% ^ [AZ] \ / index.php RewriteRule ^ index.php /?( . *)/ $ 1 [L,R = 301]
1 回答
将其添加到
DOCUMENT_ROOT
中的.htaccess
文件在Apache 2.2和2.4中测试过:)
这假设为htaccess文件激活了mod_rewrite both and . 如果您不确定,要检查是否安装了mod_rewrite,请查看
phpinfo();
输出中已安装模块的列表 . 默认情况下,未对htaccess文件启用mod_rewrite . 如果您正在管理自己的服务器,请打开httpd.conf
并确保webroot目录块包含以下行之一:AllowOverride FileInfo
或AllowOverride All