#2 Help for Friendly URLs

closed-works-for-me
1
2007-07-03
2007-06-29
Lane Lester
No

I have tried to enable friendly URLs, but it's not working. For example, I get a 404 error:
The requested URL /about.html was not found on this server.

I have confirmed that the mod_rewrite module is installed on my server.

I have this in .htaccess:
AddHandler application/x-httpd-php5 .php .php3 .phtml .php5
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^((.+)/)(.+)\.html$ index.php?section=$2&pag_name=$3 [QSA]

There is this comment in the sample .htaccess, but I don't know what it means:
# Make sure you have Options FollowSymLinks
# and Allow on

Lane

Discussion

  • Miguel Angel Da Vila

    Logged In: YES
    user_id=1651760
    Originator: NO

    # Make sure you have Options FollowSymLinks
    #
    # This avice is related to a Apache directive. From the apache documentation:
    # To enable the rewriting engine for per-directory configuration files
    # you need to set ``RewriteEngine On'' in these files and ``Options FollowSymLinks''
    # must be enabled. If your administrator has disabled override of FollowSymLinks
    # for a user's directory, then you cannot use the rewriting engine.
    # This restriction is needed for security reasons.
    #
    # It minds that the Apache directive for the directory where the website runs
    # must reads like the following:
    #
    # <Directory "/home/user/public_html/">
    # Options Indexes FollowSymlinks MultiViews # note the FollowSymlinks
    # AllowOverride All # It is also important
    # Order allow,deny
    # Allow from all # It is also important
    # </Directory>
    #

    #this should work
    RewriteEngine On

    #Rewrites page.html as index.php?pag_name=somename
    RewriteCond %{REQUEST_FILENAME} !-f [NC]
    RewriteRule ^(.+)\.html$ index.php?pag_name=$1 [QSA]

     
  • Miguel Angel Da Vila

    • labels: --> Install Problem
     
  • Miguel Angel Da Vila

    Logged In: YES
    user_id=1651760
    Originator: NO

    Did you enable the option Friendly URLs in the System behaviour screen?

     
  • Lane Lester

    Lane Lester - 2007-06-29

    Logged In: YES
    user_id=1233221
    Originator: YES

    Yes, I did enable the Friendly URLs option. If I switch it off, then I don't get the error, presumably because AC doesn't try to create the URLs.

    I read the stuff you copied from the Apache docs, but I would think that, if the server company has added the mod_rewrite module, they would have the other stuff configured. But I will pass along to their techs the information and see what they say.

    Lane

     
  • Lane Lester

    Lane Lester - 2007-06-30

    Logged In: YES
    user_id=1233221
    Originator: YES

    Miguel, this is the reply I got from the server tech, but I don't know what it means as far as what I should do to fix the problem:
    You can use the option "Options FollowSymLinks'' along with the Rewrite engine, we havent disabled the override of these functions for a user's folder.

    Am I supposed to put something in .htaccess other than:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f [NC]
    RewriteRule ^((.+)/)(.+)\.html$ index.php?section=$2&pag_name=$3 [QSA]

    Lane

     
  • Miguel Angel Da Vila

    Logged In: YES
    user_id=1651760
    Originator: NO

    Sorry for the technical stuff in my previous answer, I thought it would be useful for you in case you manages your server.

    To solve the issue you must activate Friendly ULRs in System behaviour. And the right Rewrite rule should be:

    RewriteRule ^(.+)\.html$ index.php?pag_name=$1 [QSA]

    This work fine in all my AldoContent installations. When Friendly URLs are active the system produces and expects to receive a string nor a integer.

     
  • Lane Lester

    Lane Lester - 2007-07-03

    Logged In: YES
    user_id=1233221
    Originator: YES

    Thanks, Miguel, the different RewriteRule line did the job!

    Lane

     
  • Miguel Angel Da Vila

    • status: open --> open-accepted
     
  • Miguel Angel Da Vila

    • status: open-accepted --> closed-accepted
     
  • Miguel Angel Da Vila

    • priority: 5 --> 1
    • status: closed-accepted --> closed-works-for-me
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks