Can't get permalinks working!

时间:2011-03-24 作者:Yarin

我无法让WordPress pretty permalinks在我的Fedora LAMP服务器上工作。如果我设置它们并单击页面/帖子链接,我会得到一个“哎呀!此链接似乎已断开。“”

这个。htaccess文件可写且正在更新,mod\\u重写模块似乎已加载到我的httpd中。conf(见下文)

  • 我的apache日志中的错误只是说“找不到文档”httpd.conf:

    ### Section 1: Global Environment
    
    # start the rewrite engine (I ADDED THIS)
    RewriteEngine on 
    
    ServerTokens OS
    
    ServerRoot "/etc/httpd"
    
    PidFile run/httpd.pid
    
    Timeout 120
    
    KeepAlive Off
    
    MaxKeepAliveRequests 100
    
    KeepAliveTimeout 15
    
    <IfModule prefork.c>
    StartServers       8
    MinSpareServers    5
    MaxSpareServers   20
    ServerLimit      256
    MaxClients       256
    MaxRequestsPerChild  4000
    </IfModule>
    
    
    <IfModule worker.c>
    StartServers         2
    MaxClients         150
    MinSpareThreads     25
    MaxSpareThreads     75 
    ThreadsPerChild     25
    MaxRequestsPerChild  0
    </IfModule>
    
    #
    # Listen: Allows you to bind Apache to specific IP addresses and/or
    # ports, in addition to the default. See also the <VirtualHost>
    # directive.
    #
    # Change this to Listen on specific IP addresses as shown below to 
    # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
    #
    #Listen 12.34.56.78:80
    Listen 80
    
    LoadModule auth_basic_module modules/mod_auth_basic.so
    LoadModule auth_digest_module modules/mod_auth_digest.so
    LoadModule authn_file_module modules/mod_authn_file.so
    LoadModule authn_alias_module modules/mod_authn_alias.so
    LoadModule authn_anon_module modules/mod_authn_anon.so
    LoadModule authn_dbm_module modules/mod_authn_dbm.so
    LoadModule authn_default_module modules/mod_authn_default.so
    LoadModule authz_host_module modules/mod_authz_host.so
    LoadModule authz_user_module modules/mod_authz_user.so
    LoadModule authz_owner_module modules/mod_authz_owner.so
    LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
    LoadModule authz_dbm_module modules/mod_authz_dbm.so
    LoadModule authz_default_module modules/mod_authz_default.so
    LoadModule ldap_module modules/mod_ldap.so
    LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
    LoadModule include_module modules/mod_include.so
    LoadModule log_config_module modules/mod_log_config.so
    LoadModule logio_module modules/mod_logio.so
    LoadModule env_module modules/mod_env.so
    LoadModule ext_filter_module modules/mod_ext_filter.so
    LoadModule mime_magic_module modules/mod_mime_magic.so
    LoadModule expires_module modules/mod_expires.so
    LoadModule deflate_module modules/mod_deflate.so
    LoadModule headers_module modules/mod_headers.so
    LoadModule usertrack_module modules/mod_usertrack.so
    LoadModule setenvif_module modules/mod_setenvif.so
    LoadModule mime_module modules/mod_mime.so
    LoadModule dav_module modules/mod_dav.so
    LoadModule status_module modules/mod_status.so
    LoadModule autoindex_module modules/mod_autoindex.so
    LoadModule info_module modules/mod_info.so
    LoadModule dav_fs_module modules/mod_dav_fs.so
    LoadModule vhost_alias_module modules/mod_vhost_alias.so
    LoadModule negotiation_module modules/mod_negotiation.so
    LoadModule dir_module modules/mod_dir.so
    LoadModule actions_module modules/mod_actions.so
    LoadModule speling_module modules/mod_speling.so
    LoadModule userdir_module modules/mod_userdir.so
    LoadModule alias_module modules/mod_alias.so
    LoadModule rewrite_module modules/mod_rewrite.so
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    LoadModule cache_module modules/mod_cache.so
    LoadModule suexec_module modules/mod_suexec.so
    LoadModule disk_cache_module modules/mod_disk_cache.so
    LoadModule cgi_module modules/mod_cgi.so
    
    #
    # The following modules are not loaded by default:
    #
    #LoadModule cern_meta_module modules/mod_cern_meta.so
    #LoadModule asis_module modules/mod_asis.so
    
    Include conf.d/*.conf
    
    User apache
    Group apache
    
    ### Section 2: \'Main\' server configuration
    
    
    ServerAdmin root@localhost
    
    UseCanonicalName Off
    
    DocumentRoot "/var/www/html"
    
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    
    <Directory "/var/www/html">
    
    
        Options Indexes FollowSymLinks
    
    
        AllowOverride None
    
    
        Order allow,deny
        Allow from all
    
    </Directory>
    
    
    <IfModule mod_userdir.c>
    
        UserDir disabled
    
    </IfModule>
    
    
    DirectoryIndex index.html index.html.var
    
    #
    # AccessFileName: The name of the file to look for in each directory
    # for additional configuration directives.  See also the AllowOverride
    # directive.
    #
    AccessFileName .htaccess
    
    <Files ~ "^\\.ht">
        Order allow,deny
        Deny from all
    </Files>
    
    TypesConfig /etc/mime.types
    
    DefaultType text/plain
    
    <IfModule mod_mime_magic.c>
    #   MIMEMagicFile /usr/share/magic.mime
        MIMEMagicFile conf/magic
    </IfModule>
    
    HostnameLookups Off
    
    ErrorLog logs/error_log
    
    CustomLog logs/access_log combined
    
    ServerSignature On
    
    Alias /icons/ "/var/www/icons/"
    
    <Directory "/var/www/icons">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    
    <IfModule mod_dav_fs.c>
        # Location of the WebDAV lock database.
        DAVLockDB /var/lib/dav/lockdb
    </IfModule>
    
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
    
    <Directory "/var/www/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>
    
    
    IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8
    
    ReadmeName README.html
    HeaderName HEADER.html
    
    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
    
    AddDefaultCharset UTF-8
    
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    
    AddType application/x-x509-ca-cert .crt
    AddType application/x-pkcs7-crl    .crl
    
    AddHandler type-map var
    
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    
    
    Alias /error/ "/var/www/error/"
    
    <IfModule mod_negotiation.c>
    <IfModule mod_include.c>
        <Directory "/var/www/error">
            AllowOverride None
            Options IncludesNoExec
            AddOutputFilter Includes html
            AddHandler type-map var
            Order allow,deny
            Allow from all
            LanguagePriority en es de fr
            ForceLanguagePriority Prefer Fallback
        </Directory>
    
    
    </IfModule>
    </IfModule>
    
    
    #
    # Proxy Server directives. Uncomment the following lines to
    # enable the proxy server:
    #
    #<IfModule mod_proxy.c>
    #ProxyRequests On
    #
    #<Proxy *>
    #    Order deny,allow
    #    Deny from all
    #    Allow from .example.com
    #</Proxy>
    
    #
    # Enable/disable the handling of HTTP/1.1 "Via:" headers.
    # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
    # Set to one of: Off | On | Full | Block
    #
    #ProxyVia On
    
    
    NameVirtualHost *:80
    
    
    <VirtualHost *:80>
     # start the rewrite engine
     RewriteEngine on
     ServerName www.example.com
     DocumentRoot /var/www/html/com_example_www
    </VirtualHost>
    

  • 1 个回复
    最合适的回答,由SO网友:Gavin Anderegg 整理而成

    在配置中,您有以下内容:

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    
    应将其更改为以下内容:

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    
    TheAllowOverride 指令是允许.htaccess 要读取的文件。如果仍有问题,请确保在

    <Directory "/var/www/html">
    
    还可以阻止(取决于站点所在的位置)。

    希望这有帮助!

    结束

    相关推荐

    curl problem or permalinks

    我刚刚配置了我的VPS,我使用的是Centos,一切都很好,但如果我将永久链接设置为自定义结构,然后接受主页,没有帖子出现,它会显示404页,我想这是因为我没有启用curl,但我不知道我的php在哪里。我的centos中的ini文件?好的,我的卷曲被启用了,我检查过了phpinfo(); 这里是URLhttp://74.117.158.182/info.php但如果我在我的wordpress中设置了永久链接,那么接受主页,所有都会给我404页,你可以在这个URL上查看http://mbas.co.in如果