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

Thread: .htaccess help needed - dynanmic redirect

  1. #1

    .htaccess help needed - dynanmic redirect

    Hey all!

    Need some help to redirect the old file structure to new, several lines:

    old: site/default.php?page=uk01
    new: site/txt/uk01.php

    old:site/default.php?page=us01
    new:site/txt/aus01.php


    01 means there are many pages like this with 01, 02, 03- - so it can be replaced with any expressoin

    Please post the .htaccess file I should use to redirect the old queries to new pages

    thanks!

  2. #2
    .htaccess code
    Code:
    RewriteEngine On
    RewriteRule ^txt/([^/]*)\.php$ /default.php?page=$1 [L]
    Original URL example:
    http://example.com/default.php?page=uk01

    The rewritten URL example:
    http://example.com/txt/uk01.php

  3. #3
    Quote Originally Posted by Aziz View Post
    .htaccess code
    Code:
    RewriteEngine On
    RewriteRule ^txt/([^/]*)\.php$ /default.php?page=$1 [L]
    Original URL example:
    http://example.com/default.php?page=uk01

    The rewritten URL example:
    http://example.com/txt/uk01.php


    Thanks Got a Good Example
    Visit : Paste-Bin | Yahoo Tracer | Twitter Signatures
    Contact Me For PHP Works
    An cURL Expertise

  4. #4
    hm just tried it, but it doesn't work for some reason

  5. #5
    Try Using this code
    Code:
    RewriteEngine On
    RewriteRule ^txt/([a-zA-Z0-9.*?).php default.php?page=$1
    Save in htaccess at the root of site and please confirm that RewriteMod is Enabled with server
    Visit : Paste-Bin | Yahoo Tracer | Twitter Signatures
    Contact Me For PHP Works
    An cURL Expertise

  6. #6
    you need to enable the Rewrite engine in Apache

    httpd.conf
    Code:
    LoadModule rewrite_module modules/mod_rewrite.so

  7. #7
    chetan, your code gives a 500 error.
    it's on a shared hostgator account, so I think they should have it enabled, will check it

  8. #8
    Yes 500 Misconfiguration Error is Coming on Hostgator

    Try this Simple Code this will work for sure

    Code:
    RewriteEngine On
    RewriteRule txt/(.*).php default.php?page=$1
    Visit : Paste-Bin | Yahoo Tracer | Twitter Signatures
    Contact Me For PHP Works
    An cURL Expertise

  9. #9
    still no effect.. I have the urls with /site/, so I just added site/ to both paths, dont think that could be a problem?

  10. #10
    Yes

    Code:
    RewriteEngine On
    RewriteRule /txt/(.*).php /default.php?page=$1
    Hope this will work [-o<
    Visit : Paste-Bin | Yahoo Tracer | Twitter Signatures
    Contact Me For PHP Works
    An cURL Expertise

Page 1 of 2 12 LastLast

Similar Threads

  1. .htaccess All Page Redirect
    By ProxySites.ca in forum Managing
    Replies: 7
    Last Post: 28 May, 2010, 22:52 PM
  2. .htaccess / redirect to 'www.'
    By Snak3 in forum On-Site SEO
    Replies: 12
    Last Post: 30 December, 2009, 20:13 PM
  3. .htaccess
    By dodolls in forum Managing
    Replies: 6
    Last Post: 15 November, 2009, 07:58 AM
  4. Quick redirect help needed
    By DomainMagnate in forum Managing
    Replies: 10
    Last Post: 2 May, 2009, 21:08 PM
  5. .htaccess - How to properly redirect a domain?
    By Shenron in forum Programming
    Replies: 10
    Last Post: 9 January, 2009, 09:30 AM

Tags for this Thread

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
  •