简体   繁体   English

从网址中删除“ / home”目录

[英]Remove '/home' directory from URL

People i got 'www.domain.com/home' . 我得到'www.domain.com/home' I want delete from name '/home'. 我想从名称“ / home”中删除。 Just on url should left 'www.domain.com' . 仅在url上应保留'www.domain.com'

I tested .htaccess but this not works. 我测试了.htaccess,但这不起作用。 I see server automatic delete 'index.html' from URL. 我看到服务器自动从URL删除'index.html'。 Some rules works in my htaccess but the replacing a names in URL - not. 一些规则在我的htaccess中有效,但替换URL中的名称-无效。

Somebody know how to delete '/home'? 有人知道如何删除“ / home”吗? I just spent all morning to find solution, but nothing working... 我只是整个上午都在寻找解决方案,但没有任何效果...

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: 通过httpd.conf启用mod_rewrite和.htaccess,然后将此代码放在DOCUMENT_ROOT目录下的.htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On

RewriteRule ^home/?$ / [L,R=301,NC]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM