之前我问过问题,但还没有找到解决方案。所以我再次发布一些额外的信息。我试图将所有文件从名为(Silverstripe)的子目录移动到root,但随后显示空白页面。甚至我也删除 default.aspx 和 web.config 文件。并且还使用 .htaccess 文件。而且我对这些东西并不太了解,所以这就是我在这里发布我的问题的原因。
问题是我想删除url&中的子目录永久链接也是如此。 e.g。
http://www.jtrainingsolutions.com/Silverstripe/ => http://www.jtrainingsolutions.com/
根图:
- /Silverstripe - (Subdirectory)
- root/Silverstripe/.htaccess
- root/Silverstripe/web.config
- root/and other Silverstripe CMS files
- /default.aspx
的的Default.aspx:
<%
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("www.jtrainingsolutions.com") ) > 0 Then
Response.Redirect("/Silverstripe")
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("jtrainingsolutions.com") ) > 0 Then
Response.Redirect("/Silverstripe")
End If
%>
.htaccess文件:
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files web.config>
Order deny,allow
Deny from all
</Files>
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
<IfModule mod_alias.c>
RedirectMatch 403 /silverstripe-cache(/|$)
</IfModule>
<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$)|(\.php$)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ Silverstripe/$1 [L]
RewriteBase /Silverstripe
</IfModule>
### SILVERSTRIPE END ###
和 web.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<hiddenSegments applyToWebDAV="false">
<add segment="silverstripe-cache" />
</hiddenSegments>
</requestFiltering>
</security>
<rewrite>
<rules>
<rule name="SilverStripe Clean URLs" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="sapphire/main.php?url={R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
请告诉我如何解决此问题。提前谢谢。