【问题标题】:creating htaccess file in wamp server在 wamp 服务器中创建 htaccess 文件
【发布时间】:2014-11-07 17:54:53
【问题描述】:

我正在尝试在 wamp/www/myDirectory 中创建 .htaccess 文件。 但我无法创建,上面写着'you must type file name'

我也启用了 mod-rewrite。现在我想检查 URL 隐藏,但我无法创建 .htaccess。

我已经创建了 .htaccess 文件并编写了这样的代码

# Avoid redirect loop
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]

# Add trailing slash
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://%{HTTP_HOST}/$1/ [R=302,L]

RewriteRule ^purchase(.*)$ $1 [R=302,L]

RewriteCond %{REQUEST_URI} !^/purchase/
RewriteRule ^(.*)/$ purchase/$1 [L,QSA]

我该怎么做。请推荐

【问题讨论】:

标签: apache .htaccess wamp


【解决方案1】:

您是否尝试过通过记事本创建文件?

请看这个答案:https://stackoverflow.com/a/5004695/460053

【讨论】:

  • 谢谢彼得。它对我有用。你能建议我上面的代码是写还是不写?基本上我试图从 url 隐藏购买文件夹名称
  • 我不再使用 apache,所以无法验证您的代码。试一试,看看会发生什么?
【解决方案2】:

在 windows 中,只需使用 cmd 进入文件夹并键入以下命令 DIR>.htaccess

此命令将创建一个.htaccess 文件并将其中的一些数据转储。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-15
    相关资源
    最近更新 更多