WordPress.org

Ready to get started?Download WordPress

Forums

permalinks problem on MAC (7 posts)

  1. Famous
    Member
    Posted 1 year ago #

    Permalinks won't work. Need help getting my permalinks to work.

    http://localhost/mySite/?p=123 <<< works fine
    http://localhost/mySite/blog/2013/04/16/sample-post/ <<< will not work

    I am running a MAC 10.8.3 with Apache and PHP.

    When I change this:
    Options Indexes FollowSymLinks MultiViews

    #
        # 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 None

    To this:

    AllowOverride All

    I get this error:

    Internal Server Error
    
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    My htaccess is:

    RewriteEngine On
    RewriteBase /mySite/
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    I also have this in my user/mySite config file

    <Directory "/users/mySite">
    Options Indexes MultiViews
    Options +Indexes +FollowSymLinks +ExecCGI
    Order allow,deny
    Allow from all
    AllowOverride all
    </Directory>

    Any help is much appreciated. Thanks

  2. Abhishek Ghosh
    Member
    Posted 12 months ago #

    There are two .conf files for the built in Apache in OS X, one is for the username, which demand the non-conflicting setting - AllowOverride None to avoid the conflict in one. That explains the reason for your getting error. Another AllowOverride settings is in the httpd.conf file.

    AllowOverride should be set to All here (in /private/etc/apache2/Sites) in site-named .conf file. You will see a dummy Guest.conffile there. I have opened it right now in iTerm2, its showing me the default :

    <Directory "/Users/Guest/Sites/">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    In your case its mySite.conf. You have edited it rightly to AllowOverride all. Actually the file name should be {username}.conf. username is your user account’s short name (like mine is abhishekghosh, you will see on the top bar like in my case abhishekghosh@Abhisheks-Mac-Book-Pro).
    Create that thing it in /etc/apache2/users/ location and copy paste these :

    <Directory "/Users/username/Sites/">
     Options Indexes MultiViews FollowSymLinks
     AllowOverride All AuthConfig
     Order allow,deny
     Allow from all
     </Directory>

    Save it.

    cd to /users/mySite (in your case). chown the .htaccess like chown mySite .htaccess (its from your given names, correct yourself if they is/are different).

    Do not change anything in httpd.conf file.

    Restart Apache :

    sudo apachectl restart

    Now your Mac will hear your .htaccess directive.

  3. Famous
    Member
    Posted 12 months ago #

    couldn't get that to work.
    I remember I setup my websites a bit different, not sure if that has anything to do with it. Instead of:
    Documents/AllMySites/site1
    Documents/AllMySites/site2

    I had them setup as:
    Documents/site1
    Documents/site2

    I did what you said, I created this:

    <Directory "/Users/site1/">
     Options Indexes MultiViews FollowSymLinks
     AllowOverride All AuthConfig
     Order allow,deny
     Allow from all
     </Directory>

    and put it in:

    apache2/users/site1.conf

    After I created it, I ran this command:

    sudo apachectl restart

    But no dice :(

    Any other ideas? And thanks for your help so far.

  4. Famous
    Member
    Posted 12 months ago #

    did I miss something?

    I could not change directory site1 - I get this:
    -bash: cd: /users/site1: No such file or directory

  5. Abhishek Ghosh
    Member
    Posted 12 months ago #

    I remember I setup my websites a bit different, not sure if that has anything to do with it.

    If the folder location / name (s) are different, then it will not work.
    Documents folder is under (on my Mac) :

    ~/Users/abhishekghosh/Documents

    abhishekghosh is my UNIX username. Your will be different. Run users command on Terminal / iTerm2 to get your name.

    That username folder is the default HOME of the user. Under that the Document folder is located.

    So, in my case, if I had same named folders, the full UNIX path would be :

    /Users/abhishekghosh/Documents/site1

    Replace abhishekghosh with your username. Correct the paths, edit the files there. It must work. cd to :

    cd Users/abhishekghosh/Documents/site1

    Change abhishekghosh to your username, it will work. '/' is root.

    Second way :

    Else you can set symlink :

    cd to root :

    cd /

    run :

    ln -s /Users/abhishekghosh/Documents/site1 Users/site1

    change abhishekghosh to your user name. Do not do error in upper / lower case - Users not users.

    (I have Taken that, there is no Documents named folder at root.)

  6. Famous
    Member
    Posted 12 months ago #

    My web files are located here:

    Library/WebServer/Documents/mySite1
    Library/WebServer/Documents/mySite2
    Library/WebServer/Documents/mySite3
    etc...

    That was my disconnect, I knew something was different about my setup, but it had been so long ago. You have saved me much heart ache my friend and in the process taught me quite a bit. Thank you.

    I had to point the .conf file here:

    <Directory "/Library/WebServer/Documents/fam-os">

    That enabled my .htaccess to be read as you stated. Anyhow thank you so much for your help!

  7. Abhishek Ghosh
    Member
    Posted 12 months ago #

    That enabled my .htaccess to be read as you stated. Anyhow thank you so much for your help!

    Thats great and you are welcome mate.

Topic Closed

This topic has been closed to new replies.

About this Topic