Results 1 to 8 of 8

Thread: .htaccess and WordPress permalinks

  1. #1
    Join Date
    Apr 2012
    Beans
    20

    .htaccess and WordPress permalinks

    First of all I need to say that I'm not sure whether this is an Ubuntu issue or a WordPress issue, but I've got to start somewhere so am trying this forum first.

    I've just created a new WordPress site (I'm even newer to WordPress than I am to Ubuntu). The site was successfully set up on the live domain (on a remote server with a web hosting company). I've copied it across to my own Ubuntu 12.04 server in order to try and continue development offline. I've copied all the files and the database, and have a script that automatically changes all the URL references in the database records. The home page of the local site loads OK in a web browser.

    WordPress has been set up to use permalinks - the .htaccess file was automatically generated on the live site and the permalinks work OK, so I can only presume that the syntax is correct. The .htaccess file was copied along with everything else to the local server, but the permalinks do not work in the local environment. I've checked the file permissions for .htacess and they are set to 664.

    Any ideas?

    Thanks,

    Andrew.

  2. #2
    Join Date
    Jul 2007
    Location
    Tāmaki Makau-rau, NZ
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: .htaccess and WordPress permalinks

    Thread moved to Server Platforms.
    BACKUPS are unsexy — until you discover you should have done one yesterday.
    Spare your nerves and do one before you upgrade or install.

  3. #3
    Join Date
    Nov 2008
    Location
    S.H.I.E.L.D. 6-1-6
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: .htaccess and WordPress permalinks

    Quote Originally Posted by andperry View Post
    First of all I need to say that I'm not sure whether this is an Ubuntu issue or a WordPress issue, but I've got to start somewhere so am trying this forum first.

    I've just created a new WordPress site (I'm even newer to WordPress than I am to Ubuntu). The site was successfully set up on the live domain (on a remote server with a web hosting company). I've copied it across to my own Ubuntu 12.04 server in order to try and continue development offline. I've copied all the files and the database, and have a script that automatically changes all the URL references in the database records. The home page of the local site loads OK in a web browser.

    WordPress has been set up to use permalinks - the .htaccess file was automatically generated on the live site and the permalinks work OK, so I can only presume that the syntax is correct. The .htaccess file was copied along with everything else to the local server, but the permalinks do not work in the local environment. I've checked the file permissions for .htacess and they are set to 664.

    Any ideas?

    Thanks,

    Andrew.
    rewrite may be disabled on your setup,

    Try enabling with
    Code:
    sudo a2enmod rewrite
    Last edited by sandyd; June 20th, 2013 at 10:45 AM.
    Don't waste your energy trying to change opinions ... Do your thing, and don't care if they like it.

  4. #4
    Join Date
    Apr 2005
    Location
    Finland/UK
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: .htaccess and WordPress permalinks

    Have you enabled use of .htaccess files in your Apache configuration?

    In the site configuration file make sure you have "AllowOverride All" set.

    https://help.ubuntu.com/community/En...eHtaccessFiles

  5. #5
    Join Date
    Apr 2010
    Location
    Amsterdam
    Beans
    48
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: .htaccess and WordPress permalinks

    As mentioned, it must be the rewrite module. Check if the correct modules are loaded:
    Code:
    sudo apache2ctl -t -D DUMP_MODULES
    If the rewrite module is not loaded enable it.

    @mcduck
    By default it is enabled
    Last edited by 2Stoned; June 22nd, 2013 at 04:53 PM.

  6. #6
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: .htaccess and WordPress permalinks

    Quote Originally Posted by 2Stoned View Post
    By default it is enabled
    You mean .htaccess? No, it's not. Look at the default configuration in /etc/apache2/sites-available/default.

    Code:
           DocumentRoot /var/www
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    The first <Directory> stanza applies to any directory other than /var/www which is governed by the second stanza. Neither of these enable .htaccess by default since they include "AllowOverride None".
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  7. #7
    Join Date
    Apr 2010
    Location
    Amsterdam
    Beans
    48
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: .htaccess and WordPress permalinks

    Quote Originally Posted by SeijiSensei View Post
    You mean .htaccess? No, it's not. Look at the default configuration in /etc/apache2/sites-available/default.
    You are right. I tought it was enabled by default

  8. #8
    Join Date
    Apr 2012
    Beans
    20

    Re: .htaccess and WordPress permalinks

    I have implemented the suggestions made in this thread. The other problem I found was that the .htaccess file was in DOS format because I had created it originally in Windows across a SAMBA share. Converted it to Unix format.

    Don't know exactly which of the factors contributed, but it's all up and running now.

    Many thanks everyone for your help.

    Andrew.

Bookmarks

Posting Permissions

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