【问题标题】:Custom directory in Joomla when using search engine friendly URLs使用搜索引擎友好 URL 时 Joomla 中的自定义目录
【发布时间】:2013-03-19 01:45:05
【问题描述】:
我正在使用 Joomla 2.5 附带的标准 .htaccess 文件。 Joomla 安装在根目录中,我使用的是搜索引擎友好的 URL。
我可以在 .htaccess 文件的开头添加一些内容,以检查我在 url 中的自定义目录并允许正常访问而无需重写任何 url?
例如,如果我希望 customdir/ 作为包含所有自定义页面和脚本的目录,我会链接到类似 http://mysite.com/customdir/customscript.php
这可能吗?
【问题讨论】:
标签:
apache
.htaccess
joomla
【解决方案1】:
您可以尝试在标准 Joomla .htaccess 文件中添加这些行,在下面的 2 个注释行中:
## Begin - Custom redirects
RewriteCond %{REQUEST_URI} ^/customdir [NC]
RewriteCond %{REQUEST_URI} !customscript\.php [NC]
RewriteRule .* /customdir/customscript.php [L]
## End - Custom redirects
静默地图:
http://mysite.com/customdir/ 或
http://mysite.com/customdir/anything/
收件人:
http://mysite.com/customdir/customscript.php
对于永久且可见的重定向,请将 [L] 替换为 [R=301,L]