Mod Rewrite

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stefan Reiter

    Mod Rewrite

    Hi,

    I got a totally dynamic website, and to improve my search engine
    results, I would like to use mod rewrite.

    From what I've understood so far, I have to put the necesarry lines
    into my htacess file, right?

    Anyway, I read some tutorials, but I can't quite grasp how to
    do it in my case -

    I have an url like that:
    URL.com is a sought-after domain that MediaOptions can help broker for you. Contact us today to get the domain name your company needs!

    and I want it rewritten to:
    URL.com is a sought-after domain that MediaOptions can help broker for you. Contact us today to get the domain name your company needs!


    How can I get this done?

    Thanks,


    Stefan
  • ZeldorBlat

    #2
    Re: Mod Rewrite

    In the case you've described, your rewrite-rule would look something
    like this (not tested):

    RewriteRule ^/(*)$ /index.php?page= $1

    In other words, in the original URL match everything after the / and
    call it $1. Then in your re-written URL you just use the $1 to
    represent the pattern that was matched.

    Comment

    • Stefan Reiter

      #3
      Re: Mod Rewrite

      I just realized - that is only my page variable -
      but what happens with the other variables I am using sometimes?
      URL.com is a sought-after domain that MediaOptions can help broker for you. Contact us today to get the domain name your company needs!


      u can't rewrite it to an url like
      URL.com is a sought-after domain that MediaOptions can help broker for you. Contact us today to get the domain name your company needs!


      Can you?

      Or should it be something like

      URL.com is a sought-after domain that MediaOptions can help broker for you. Contact us today to get the domain name your company needs!


      Or how should it be done the best way possible for search engines?

      Cheers,

      Stefan

      ZeldorBlat schrieb:[color=blue]
      > In the case you've described, your rewrite-rule would look something
      > like this (not tested):
      >
      > RewriteRule ^/(*)$ /index.php?page= $1
      >
      > In other words, in the original URL match everything after the / and
      > call it $1. Then in your re-written URL you just use the $1 to
      > represent the pattern that was matched.
      >[/color]

      Comment

      • Jerry Stuckle

        #4
        Re: Mod Rewrite

        Stefan Reiter wrote:[color=blue]
        > I just realized - that is only my page variable -
        > but what happens with the other variables I am using sometimes?
        > https://www.url.com/index.php?page=f...riable2=value2
        >
        >
        > u can't rewrite it to an url like
        > https://www.url.com/index.php?page=f...riable2=value2
        >
        >
        > Can you?
        >
        > Or should it be something like
        >
        > https://www.url.com/index.php?page=f...riable2=value2
        >
        >
        > Or how should it be done the best way possible for search engines?
        >
        > Cheers,
        >
        > Stefan[/color]

        And your PHP question is?????

        P.S. Please don't top post.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • jimmy88@gmail.com

          #5
          Re: Mod Rewrite


          Stefan Reiter wrote:[color=blue]
          > I just realized - that is only my page variable -
          > but what happens with the other variables I am using sometimes?
          > https://www.url.com/index.php?page=f...riable2=value2
          >
          > u can't rewrite it to an url like
          > https://www.url.com/index.php?page=f...riable2=value2
          >
          > Can you?
          >
          > Or should it be something like
          >
          > https://www.url.com/index.php?page=f...riable2=value2
          >
          > Or how should it be done the best way possible for search engines?
          >
          > Cheers,
          >
          > Stefan
          >
          > ZeldorBlat schrieb:[color=green]
          > > In the case you've described, your rewrite-rule would look something
          > > like this (not tested):
          > >
          > > RewriteRule ^/(*)$ /index.php?page= $1
          > >
          > > In other words, in the original URL match everything after the / and
          > > call it $1. Then in your re-written URL you just use the $1 to
          > > represent the pattern that was matched.
          > >[/color][/color]

          heres what i use
          RewriteEngine On
          RewriteCond %{REQUEST_FILEN AME} !-f
          RewriteCond %{REQUEST_FILEN AME} !-d
          RewriteRule ^(.*)$ index.php?page= $1 [L,QSA]

          It checks if the url is a dir or a file & then it rewrites it with the
          extra querystring.
          good luck

          Comment

          Working...