Results 1 to 3 of 3

Thread: Can't get Apache to process .htaccess

  1. #1

    Question Can't get Apache to process .htaccess

    Hi,

    New, working, install of openSUSE 12.1 (x86_64). I have a CentOS background.

    Problem: .htaccess isn't being processed (mod_rewrite gives 404).

    Tried: Everything available
    SDB:Linux Apache MySQL PHP - openSUSE
    Enable mod_rewrite Apache 2.0 rewrite module on SuSE Linux | enarion.net
    Enable mod_rewrite for OpenSuse 12.1
    (w/ multiple reboots for good measure)


    phpinfo() shows:
    Code:
    Loaded Modules 	core prefork http_core mod_so mod_actions mod_alias mod_auth_basic mod_authn_file mod_authz_host mod_authz_groupfile mod_authz_default mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_expires mod_include mod_log_config mod_mime mod_negotiation mod_setenvif mod_ssl mod_userdir mod_php5 mod_deflate mod_rewrite

    /etc/apache2/default-server.conf:
    Code:
    <Directory "/srv/www/htdocs">
    	# Possible values for the Options directive are "None", "All",
    	# or any combination of:
    	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    	#
    	# Note that "MultiViews" must be named *explicitly* --- "Options All"
    	# doesn't give it to you.
    	#
    	# The Options directive is both complicated and important.  Please see
    	# http://httpd.apache.org/docs-2.2/mod/core.html#options
    	# for more information.
    	Options All
    	# AllowOverride controls what directives may be placed in .htaccess files.
    	# It can be "All", "None", or any combination of the keywords:
    	#   Options FileInfo AuthConfig Limit
    	AllowOverride ALL
    	# Controls who can get stuff from this server.
    	Order allow,deny
    	Allow from all
    </Directory>
    Standard v.hosts conf files. (default pasted below)

    http://phpmyadmin.localhost/ - works perfectly (doesn't use .htaccess)

    http://books.localhost/ - loads base Drupal install
    http://books.localhost/user/register - 404s


    Using the example at: Enable mod_rewrite Apache 2.0 rewrite module on SuSE Linux | enarion.net
    http://localhost/ - loads "It works!"
    http://localhost/user/something - 404s

    localhost .htaccess
    Code:
    Options +FollowSymlinks
    RewriteEngine on
    #RewriteBase /
    RewriteRule user/(.*)$ /user.php?user=$1

    # # #

    Logs just show 404s.

    I'm used to CentOS, where the default Apache config "just works", so, what am I missing?

    Thanks,
    Michael


    00-default.conf
    Code:
    #
    # VirtualHost template
    # Note: to use the template, rename it to /etc/apache2/vhost.d/yourvhost.conf. 
    # Files must have the .conf suffix to be loaded.
    #
    # See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints 
    # about virtual hosts.
    #
    # NameVirtualHost statements can be added to /etc/apache2/listen.conf.
    #
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for requests without a known
    # server name.
    #
    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName localhost
    
        # DocumentRoot: The directory out of which you will serve your
        # documents. By default, all requests are taken from this directory, but
        # symbolic links and aliases may be used to point to other locations.
        DocumentRoot /srv/www/htdocs/vhosts/localhost
    
        # if not specified, the global error log is used
        ErrorLog /var/log/apache2/localhost-error_log
        CustomLog /var/log/apache2/localhost-access_log combined
    
        # don't loose time with IP address lookups
        HostnameLookups Off
    
        #
        # This should be changed to whatever you set DocumentRoot to.
        #
        <Directory "/srv/www/htdocs/vhosts/localhost">
        
    	#
    	# Possible values for the Options directive are "None", "All",
    	# or any combination of:
    	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    	#
    	# Note that "MultiViews" must be named *explicitly* --- "Options All"
    	# doesn't give it to you.
    	#
    	# The Options directive is both complicated and important.  Please see
    	# http://httpd.apache.org/docs-2.2/mod/core.html#options
    	# for more information.
    	#
    	Options All
        
    	#
    	# AllowOverride controls what directives may be placed in .htaccess files.
    	# It can be "All", "None", or any combination of the keywords:
    	#   Options FileInfo AuthConfig Limit
    	#
    	AllowOverride All
        
    	#
    	# Controls who can get stuff from this server.
    	#
    	Order allow,deny
    	Allow from all
        
        </Directory>
    
    </VirtualHost>
    httpd.conf.local
    Code:
    RewriteEngine On
    
    NameVirtualHost *:80
    
    User michael
    Group michael
    httpd.conf
    Code:
    # forbid access to the entire filesystem by default
    # <Directory />
    #     Options None
    #     AllowOverride None
    #     Order deny,allow
    #     Deny from all
    # </Directory>
    
    
    # use .htaccess files for overriding,
    AccessFileName .htaccess
    # and never show them
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
    </Files>

  2. #2
    Join Date
    Aug 2010
    Location
    USA
    Posts
    87

    Default Re: Can't get Apache to process .htaccess

    I realize this is an old post but... I'll add to it.
    I was having issues with rewrite like this too.

    First success was switching doc root from /srv/www/htdocs/ to /home/~username/public_html/
    Though it may not be needed in retrospect. Debugging one directory location seemed efficient at the time.

    Wasn't quite there yet still had to:
    sudo a2enmod rewrite
    sudo /etc/init.d/apache2 force-reload
    I did this for mod_deflate too fyi ksystemlog was a great help to access apache logs quickly.
    This was after trying all the same configs you linked to above.
    I just didn't have time to sort out the vhosts vs. ~user/public_html issues maybe another day?
    | openSUSE 12.2 Milestone4 32bit | KDE 4.8.3
    | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
    | GeForce 6200@433Mhz 512MB | NVIDIA-Linux-x86-295.49

  3. #3
    Join Date
    Jun 2008
    Location
    /dev/swat
    Posts
    1,181

    Default Re: Can't get Apache to process .htaccess

    I was having the same issue on openSUSE 11.3 some time ago, and it really took my time to configure it. After successful configuration, i wrote an article about it. Here it is:
    Enable mod_rewrite on openSUSE 11.3 [Linux] - anl4u

    Yup, that's correct CentOS will give every thing enabled out of the box, and that's another reason why i use it for servers now.
    But still need to configure it on my laptop for local use(openSUSE 12.1).

    Good luck.
    Linux[openSUSE, KDE], PHP, MySQL, Wordpress, Tech News, etc :
    http://anl4u.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •