1

总体目标是创建一个类似推特的网站,如果您尝试访问任何未指明的页面,您将被带到个人资料页面。虽然在大多数情况下这有点简单,但由于 !-f 命令有点没用,它在 Joomla 内部变得有点复杂。文章标题实际上并不存在,所以这个不存在。

我可以使用的唯一替代方法是列出我不想重定向的每个页面作为条件。结果是这样的。自定义重定向是有问题的部分。

# Use PHP5.3 as default
AddHandler application/x-httpd-php53 .php

RewriteEngine on


#Options +FollowSymLinks
Options +SymLinksIfOwnerMatch

## Mod_rewrite in use.

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !how-it-works
RewriteCond %{REQUEST_FILENAME} !plans-and-pricing
RewriteCond %{REQUEST_FILENAME} !contact-us
RewriteCond %{REQUEST_FILENAME} !login
RewriteRule ^(.*)$ ./index.php?option=com_profiles&view=publica&Name=$1 [R=301]
## End - Custom redirects 

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.

现在,这与一个小问题完美结合。看来这个页面的css实际上是在使用引用页面的。Joomla 是模块化制作的,因此模板需要一个内容部分,并且内容部分正在被替换,而其余部分则没有。这包括链接到样式表的头文件。

我希望这里的一些人能够看看这个并告诉我是什么阻止了它成为一个正确的重定向。我并没有真正使用 htacess,所以我忽略了一些细微差别。

4

0 回答 0