基于服务器的Dynamic RewriteBase

时间:2018-01-17 11:00:09

标签: .htaccess

如何创建识别服务器路径的动态.htaccess文件。它需要在localhost文件夹上工作,路径为:

/Library/WebServer/Documents/myscaryproject/.htaccess

并在托管服务器路径上:

/domains/mydomain/.htaccess

这是我目前的.htaccess:

ErrorDocument 404 /myscaryproject/404.php

RewriteEngine on

# removing index.php from url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ /myscaryproject/index.php?event=$1 [L]

# removing index.php and replacing it with event and page parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ /myscaryproject/index.php?event=$1&p=$2 [L]

RewriteRule ^login/?$ login.php  [NC]

如果我将它推送到服务器,这一切都行不通,因为路径不正确。

0 个答案:

没有答案