简体   繁体   English

在.htaccess中指定重写参数

[英]Specify rewrite parameter in .htaccess

In my htaccess I think I must wrong path of RewriteBase. 在我的htaccess中,我认为我必须弄错RewriteBase的路径。

My server has this structure: 我的服务器具有以下结构:

/public_html/example

and in this example there are all my site so to go on my site I do this url: 在此示例中,我拥有所有网站,因此要进入我的网站,请输入以下网址:

http://home.com/example

But I get 500 internal server because I think I wrong my RewriteBase in my htacess: 但是我得到500个内部服务器,因为我认为我在htacess中弄错了我的RewriteBase:

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /example/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /example/index.php [L]
</IfModule>


AuthBasicProvider file

AuthUserFile /public_html/festivalmusicasullacqua/.htpasswd.txt
AuthName "Authorization Form Title"
AuthType Basic

#Allow any valid user
require valid-user

#Allow only one user with specified username
require user festival

Anyone can help me to correct the code? 有人可以帮助我更正代码吗?

You have two parts in your .htaccess file: a rewrite part, and an auth part. .htaccess文件中有两个部分:一个重写部分和一个auth部分。 I think that the error is not in the rewrite part, but in the auth part (you can try commenting it to confirm this hypothesis). 我认为该错误不是在重写部分中,而是在auth部分中(您可以尝试对其进行评论以确认这一假设)。

If I am right and the error is in the auth part, the reason is probably that FTP chroots you. 如果我是正确的,并且错误出在auth部分,则原因可能是FTP chroot您。 Then you only see a relative filesystem path. 然后,您只会看到一个相对的文件系统路径。

Thus I doubt that the AuthUserFile line has a correct path: you must specify an absolute path. 因此,我怀疑AuthUserFile行是否具有正确的路径:您必须指定一个绝对路径。

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

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