Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: How do I know if Mod-Rewrite is working?

  1. #1
    Join Date
    Jul 2006
    Location
    Calgary, Alberta
    Beans
    1,123
    Distro
    Ubuntu 13.04 Raring Ringtail

    How do I know if Mod-Rewrite is working?

    I ran:
    Code:
    sudo a2enmod rewrite
    and it was successful but when I go into Gallery2 on my website, it says it's not using mod-rewrite. Then I activate Permalinks in Wordpress and it breaks all the pages outside the main page.

  2. #2
    Join Date
    Dec 2006
    Location
    Canberra, AUS
    Beans
    366
    Distro
    Hardy Heron (Ubuntu Development)

    Re: How do I know if Mod-Rewrite is working?

    Did you restart apache for the rewrite module to kick in?


  3. #3
    Join Date
    Jul 2006
    Location
    Calgary, Alberta
    Beans
    1,123
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: How do I know if Mod-Rewrite is working?

    Quote Originally Posted by conjur3r View Post
    Did you restart apache for the rewrite module to kick in?
    Yes, restarted it. Then tried to reenable the module and it said it was already enabled. Then restarted Apache again. I cannot figure out why the regular Wordpress links work but as soon as I activate the Permalinks, all the pages break.

    However on the website I have that's hosted remotely, which I pay for, Permalinks work perfectly fine. Must be a setting somewhere on my server, I figured it was with Rewrite.

  4. #4
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How do I know if Mod-Rewrite is working?

    What does the apache error log say about your broken permalinks?

    Jim

  5. #5
    Join Date
    Jan 2005
    Location
    Netherlands
    Beans
    76
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How do I know if Mod-Rewrite is working?

    If you create and upload a php file "phpinfo.php" with the following
    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    When checking it with www.yoursite.com/phpinfo.php check the section "apache", there should see mod_rewrite under loaded modules.

  6. #6
    Join Date
    Jul 2006
    Location
    Calgary, Alberta
    Beans
    1,123
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: How do I know if Mod-Rewrite is working?

    Quote Originally Posted by Zillion View Post
    If you create and upload a php file "phpinfo.php" with the following
    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    When checking it with www.yoursite.com/phpinfo.php check the section "apache", there should see mod_rewrite under loaded modules.
    Yup. Does this mean it's working?

    Loaded Modules
    core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_status

  7. #7
    Join Date
    Jul 2006
    Location
    Calgary, Alberta
    Beans
    1,123
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: How do I know if Mod-Rewrite is working?

    Quote Originally Posted by cariboo907 View Post
    What does the apache error log say about your broken permalinks?

    Jim
    Where do I find this? Webmin? Under a certain folder?

    EDIT - Found the location in webmin. Here's what the error.log says for the part where I was turning Permalinks on/off in Wordpress:
    [Thu Jan 29 20:44:51 2009] [error] [client 10.0.0.2] File does not exist: /home/deemar/public_html/examples/birth/about, referer: http://10.0.0.6/examples/birth/
    [Thu Jan 29 21:13:31 2009] [error] [client 10.0.0.2] File does not exist: /home/deemar/public_html/examples/birth/about, referer: http://10.0.0.6/examples/birth/
    [Thu Jan 29 21:25:26 2009] [error] [client 10.0.0.2] File does not exist: /home/deemar/public_html/examples/birth/wpg2, referer: http://10.0.0.6/examples/birth/
    [Thu Jan 29 21:25:56 2009] [error] [client 10.0.0.2] File does not exist: /home/deemar/public_html/examples/birth/wpg2, referer: http://10.0.0.6/examples/birth/?page_id=3
    I don't yet have it set up on a domain, just bought one yesterday and have to set up the name servers first. Using the IP for now. So it works when using the page_id but once I turn on Permalinks, it changes the URL to .../wpg2 or .../about and I assume Apache2 is looking for those folders which don't exist. They're just URL rewrites but it's still pointing to the same page as before.
    Last edited by Maheriano; January 31st, 2009 at 01:33 AM.

  8. #8
    Join Date
    Dec 2006
    Location
    Canberra, AUS
    Beans
    366
    Distro
    Hardy Heron (Ubuntu Development)

    Re: How do I know if Mod-Rewrite is working?

    Quote Originally Posted by Maheriano View Post

    Loaded Modules
    core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_status
    Yeah it's on!

    The other method to see if you have it available and when you do not have php installed is to run the following in a command line (it could be apache2ctl):

    # sudo apachectl -t -D DUMP_MODULES

    So now that you know the rewrite module is on, the next step is to configure your rewriting rules. This can be done through httpd.conf or in .htaccess. Most of the time, the web apps provide a htaccess file within the distribution but may have it disabled by renaming it. You should follow their instructions on enabling pretty urls.
    Last edited by conjur3r; January 31st, 2009 at 01:55 AM.


  9. #9
    Join Date
    Jul 2006
    Location
    Calgary, Alberta
    Beans
    1,123
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: How do I know if Mod-Rewrite is working?

    Quote Originally Posted by conjur3r View Post
    Yeah it's on!

    The other method to see if you have it available and when you do not have php installed is to run the following in a command line (it could be apache2ctl):

    # sudo apachectl -t -D DUMP_MODULES

    So now that you know the rewrite module is on, the next step is to configure your rewriting rules. This can be done through httpd.conf or in .htaccess. Most of the time, the web apps provide a htaccess file within the distribution but may have it disabled by renaming it. You should follow their instructions on enabling pretty urls.
    Where do I find these 2 files and am I looking for an online guide on how to work them? I found both of them in various Apache2 folders but they were blank.

  10. #10
    Join Date
    Jan 2005
    Location
    Netherlands
    Beans
    76
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How do I know if Mod-Rewrite is working?

    You need to create a .htaccess file with some mod_rewrite rules in the root of your website, else rewrite function will not work good.

    Put this in it and save it as .htaccess :

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    Last edited by Zillion; January 31st, 2009 at 10:12 AM.

Page 1 of 2 12 LastLast

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
  •