0

I have the following in my .htaccess file

    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php

    Options -Indexes


    # preserve bandwidth for PHP enabled servers
    <ifmodule mod_php4.c>
     php_value zlib.output_compression 16386
    </ifmodule>

    # For security reasons, Option followsymlinks cannot be overridden.
    #Options +FollowSymLinks
    Options +SymLinksIfOwnerMatch
    RewriteEngine On
    RewriteRule ^faq/?$ faq.php
    RewriteRule ^about/?$ about.php
    RewriteRule ^portfolio/(.*)$ portfolio.php?p=$1

            #Error Page___NOT found
    ErrorDocument 404 /notfound.php

My portfolio only contains the sections "celebrity","weddings" and "industrial" i.e. only the following pages are valid portfolios:

    mysite.com/portfolio/celebrity
    mysite.com/portfolio/weddings
    mysite.com/portfolio/industrial

I'm having problems with the "portfolio" page in certain situations: When i visit

    "mysite.com/portfolio/celebrity"
    "mysite.com/portfolio/weddings"
    "mysite.com/portfolio/industrial"

everything works fine.If, however, i visit

    "mysite.com/portfolio/celebrity/"
    "mysite.com/portfolio/weddings/"
    "mysite.com/portfolio/industrial/"

(notice the trailing slash),Firefox gives me the following error

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

I've tried replacing the last line with

    RewriteRule ^portfolio/(.*)/?$ portfolio.php?p=$1

which doesn't help either, and displays the aforementioned error.

Visiting

    "mysite.com/portfolio/some-non-existent-portfolio"

OR

    "mysite.com/portfolio/some-non-existent-portfolio/"

doesn't redirect to "notfound.php"

2
  • Try adding Options -MultiViews Commented Mar 3, 2012 at 18:21
  • no, that doesn't solve the problem...any other ideas ? Commented Mar 3, 2012 at 20:49

1 Answer 1

3

Ok, solved it thanks to this webpage : http://www.phpfreaks.com/forums/index.php?topic=167839.0

I changed the relevant line to

    RewriteRule ^portfolio/([a-zA-Z]+)/?$ portfolio.php?p=$1

Now everything works perfectly, including showing 'notfound.php' when portfolio type visited is a non-existent one. Hope this helps somebody.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.