RewriteEngine On
RewriteRule ^http://example.lk/example1/ln1/([^/]*)$ http://example.lk/example1?ln1=$1 [L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "http\:\/\/example\.lk\/ln\/1" [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^contactus$ "http\:\/\/example\.lk\/example3\/cm\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^example\.lk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.lk$
RewriteRule ^example2$ "http\:\/\/example\.lk\/example2\/a\/\$1" [R=301,L]
RewriteCond %{HTTP_HOST} ^example\.lk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.lk$
RewriteRule ^example4$ "http\:\/\/example\.lk\/example4\?\/vi\/\$1" [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^example6$ "http\:\/\/example\.lk\/example6\/id\/\$1" [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^example1$ "http\:\/\/example\.lk\/example1\/ln2\/\$1" [R=301,L]
重写不起作用但在.htaccess中出现内部错误
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- dtutlamjasblef7982 2013-12-10 15:00关注
As pointed out, there a number of errors, please read the manual.
You don't need to double quote or escape the redirect substitutions.
You don't need to match the
${HTTP_HOST}
if you don't care what it is.You can't have a
$1
in the substitution without a matching group in the pattern.I've tried to fix some of the problems... but you need to provide more information on what specifically doesn't work and what you're trying to achieve.
RewriteEngine On RewriteRule ^example1/ln1/([^/]*)$ http://example.lk/example1?ln1=$1 [L] # RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^/?$ http://example.lk/ln/1 [R=301,L] # RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^contactus$ http://example.lk/example3/cm/ [R=301,L] RewriteCond %{HTTP_HOST} ^example\.lk$ [OR] RewriteCond %{HTTP_HOST} ^www\.example\.lk$ RewriteRule ^example2$ http://example.lk/example2/a/ [R=301,L] RewriteCond %{HTTP_HOST} ^example\.lk$ [OR] RewriteCond %{HTTP_HOST} ^www\.example\.lk$ RewriteRule ^example4$ http://example.lk/example4/vi/ [R=301,L] #RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^example6$ http://example.lk/example6/id/ [R=301,L] #RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^example1$ http://example.lk/example1/ln2/ [R=301,L]
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 2024-五一综合模拟赛
- ¥15 下图接收小电路,谁知道原理
- ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
- ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
- ¥15 手机接入宽带网线,如何释放宽带全部速度
- ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
- ¥15 ETLCloud 处理json多层级问题
- ¥15 matlab中使用gurobi时报错
- ¥15 这个主板怎么能扩出一两个sata口
- ¥15 不是,这到底错哪儿了😭