htaccess rewrite rule help needed.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cooldude7
    Confirmed User
    • Nov 2009
    • 4306

    #1

    htaccess rewrite rule help needed.

    these both giving me 500 error

    RewriteRule ^(.*)$ /search.php?s=$1 [L]



    RewriteRule ^([^/]*)$ /search.php?s=$1 [L]

    can anybody help. ?

    what i wanted to do is

    domain.com/anything to go to domain.com/search.php?s=anything

    thanks
  • cooldude7
    Confirmed User
    • Nov 2009
    • 4306

    #2
    i tried this

    RewriteEngine On

    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /search.php?s=$1 [L]
    </IfModule>


    but if i access

    domain.com/somefile.php

    it goes to search.,., wtf

    Comment

    • RonTheDon
      Registered User
      • Dec 2011
      • 69

      #3
      See what this does:

      ReWriteRule ^(.*)$ search.php?search.php?s=$1


      Notice the removal of '/' from the beginning of search.php

      If anything, ping me on ICQ and I'll try and help further.
      ICQ: 609051050

      Comment

      • leg4
        Confirmed User
        • May 2003
        • 4429

        #4
        Any luck? did you get it working?
        >>> Contact me here

        email me here

        Comment

        • cooldude7
          Confirmed User
          • Nov 2009
          • 4306

          #5
          Originally posted by leg4
          Any luck? did you get it working?
          nope., something is missing there.,

          and even the script is encrypted.,.,

          Comment

          • redwhiteandblue
            Bollocks
            • Jun 2007
            • 2785

            #6
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*) search.php?s=$1

            is mine.
            Interserver unmanaged AMD Ryzen servers from $73.00

            Comment

            • fris
              I have to go potty
              • Aug 2002
              • 55853

              #7
              Originally posted by cooldude7
              these both giving me 500 error

              RewriteRule ^(.*)$ /search.php?s=$1 [L]



              RewriteRule ^([^/]*)$ /search.php?s=$1 [L]

              can anybody help. ?

              what i wanted to do is

              domain.com/anything to go to domain.com/search.php?s=anything

              thanks
              bad idea.
              Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


              My Newest Theme

              Comment

              • raymor
                Confirmed User
                • Oct 2002
                • 3745

                #8
                Originally posted by cooldude7
                these both giving me 500 error

                RewriteRule ^(.*)$ /search.php?s=$1 [L]



                RewriteRule ^([^/]*)$ /search.php?s=$1 [L]

                can anybody help. ?

                what i wanted to do is

                domain.com/anything to go to domain.com/search.php?s=anything

                thanks
                Either of those lines alone will give you a 500 error.
                You definitely need either:
                RewriteCond %{REQUEST_FILENAME} !-f

                or:

                RewriteCond !search.php

                Without either, /Ray redirects to search.php?Ray
                search.php?Ray redirects to search.php?search.php
                search.php?search.php redirects again to search.php?search.php
                round and round in a circle
                For historical display only. This information is not current:
                support&#64;bettercgi.com ICQ 7208627
                Strongbox - The next generation in site security
                Throttlebox - The next generation in bandwidth control
                Clonebox - Backup and disaster recovery on steroids

                Comment

                • cooldude7
                  Confirmed User
                  • Nov 2009
                  • 4306

                  #9
                  Originally posted by redwhiteandblue
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule ^(.*) search.php?s=$1

                  is mine.

                  okie.,

                  Originally posted by fris
                  bad idea.
                  roger that., i left it as it is.,

                  Originally posted by raymor
                  Either of those lines alone will give you a 500 error.
                  You definitely need either:
                  RewriteCond %{REQUEST_FILENAME} !-f

                  or:

                  RewriteCond !search.php

                  Without either, /Ray redirects to search.php?Ray
                  search.php?Ray redirects to search.php?search.php
                  search.php?search.php redirects again to search.php?search.php
                  round and round in a circle
                  RewriteCond %{REQUEST_FILENAME} !-f

                  gives lots of errors.

                  RewriteCond !search.php

                  gives 500

                  thanks for your time.,

                  Comment

                  • fris
                    I have to go potty
                    • Aug 2002
                    • 55853

                    #10
                    Originally posted by cooldude7
                    okie.,



                    roger that., i left it as it is.,



                    RewriteCond %{REQUEST_FILENAME} !-f

                    gives lots of errors.

                    RewriteCond !search.php

                    gives 500

                    thanks for your time.,
                    is this a wp site?

                    maybe this will interest you, i did this for someone a while back, they wanted

                    Code:
                    domain.com/search/search-term.html
                    Code:
                    Options +FollowSymLinks
                    RewriteEngine On
                    RewriteRule ^search/(.+)\.html$ /index.php?s=$1 [QSA,L]
                    not sure if this will help you
                    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                    My Newest Theme

                    Comment

                    Working...