簡體   English   中英

URL重寫在我的apache2中不起作用

[英]URL Rewriting don't work in my apache2

我的apache2出現問題,URL重寫不起作用,我也不知道為什么...

在我的phpinfo()中,我有:

Loaded Modules: mod_rewrite 

我的.htaccess:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^test\.html$ /test.php [L]

我的Apache配置:

<VirtualHost>
        ServerAdmin mail@gmail.com
        ServerName www.site.com
        ServerAlias site.com
        DocumentRoot /var/www/site.com/

        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/site.com/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

我認為我的配置是正確的,但是我真的不知道為什么我的改寫不起作用...你有想法嗎?

非常感謝 !

對於此特定規則:

RewriteRule ^test\.html$ /test.php [L]

Mod_negotiation將嘗試為您處理它。 如果您希望Multiviews off它:

Options -Multiviews

在htaccess文件頂部,或將其從<Directory>容器中刪除:

    <Directory /var/www/site.com/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM