【问题标题】:URL rewriting in order to use joomla SEF为了使用 joomla SEF 重写 URL
【发布时间】:2014-03-31 19:38:48
【问题描述】:

我对 apache 很陌生。我阅读并阅读文档,打开我找到的所有 conf 文件,但是...

虽然我是网络服务器的 root,但我读到为了优化 apache2,使用 .htaccess 文件 (http://httpd.apache.org/docs/current/howto/htaccess.html) 不是一个好主意。

好的,我阅读了很多关于 url_rewriting 和 htacess 的操作指南。我在我的 www.site.com 虚拟主机文件中尝试了这段代码:

<VirtualHost *:80>
    ServerName site.com
    ServerAlias www.site.com
    ServerAdmin webmaster@site.com
    DocumentRoot /var/www/www.site.com
    RewriteEngine On
    <directory />
          RewriteBase /var/www/www.site.com/
          RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
          RewriteCond %{REQUEST_URI} !^/index\.php
          RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|$
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule .* index.php [L]
          Options FollowSymLinks
          AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

请注意,RewriteBase 已经使用 DocumentRoot 值和'/'进行了测试,并且所有 RewriteCond 都来自最新 Joomla 的 std_htaccess!源代码。

Apache2 启动良好,网站在线查看没有错误,但由于 joomla SEF 不工作,重写不工作 :( 我完全迷路了......再次......我需要你们的帮助!

【问题讨论】:

    标签: mod-rewrite apache2 joomla3.0


    【解决方案1】:

    好的,正确的方法是

    <directory /var/www/www.site.com/>
                  RewriteEngine On
                  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
                  RewriteCond %{REQUEST_URI} !^/index\.php
                  RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule .* index.php [L]
                  Options FollowSymLinks
                  AllowOverride None
            </Directory>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-14
      • 2013-10-26
      • 2013-06-05
      • 1970-01-01
      • 2013-03-16
      • 2014-11-05
      • 2013-04-16
      • 2012-10-28
      相关资源
      最近更新 更多