.Htaccess url redirection help

5 replies
I want to rename the following url to seo friendly url .

  1. Change the following URL :http://www.peacockgirls.com/index.php?page=1 into http://www.peacockgirls.com
  2. Chage the following URL : http://www.peacockgirls.com/index.php?page=2 into http://www.peacockgirls.com/greece-escort
  3. Chage the following URL : http://www.peacockgirls.com/index.php?page=3 into http://www.peacockgirls.com/athens-escort
  4. Chage the following URL : http://www.peacockgirls.com/index.php?page=4 into http://www.peacockgirls.com/bookings
  5. Chage the following URL : http://www.peacockgirls.com/index.php?page=5 into http://www.peacockgirls.com/jobs
  6. Chage the following URL : http://www.peacockgirls.com/index.php?page=6 into http://www.peacockgirls.com/contact-us
  7. Chage the following URL : http://www.peacockgirls.com/index.php?page=24 into http://www.peacockgirls.com/articles
  8. Chage the following URL : http://www.peacockgirls.com/index.php?page=7 into http://www.peacockgirls.com/links
  9. Chage the following URL : http://www.peacockgirls.com/index.php?profile=22 into http://www.peacockgirls.com/profile/aleena
  10. Chage the following URL : http://www.peacockgirls.com/index.php?profile=40 into http://www.peacockgirls.com/profile/fabiana
  11. Chage the following URL : http://www.peacockgirls.com/index.php?profile=48 into http://www.peacockgirls.com/profile/sabrina
  12. Chage the following URL : http://www.peacockgirls.com/index.php?profile=69 into http://www.peacockgirls.com/profile/suzanna
  13. Chage the following URL : http://www.peacockgirls.com/index.php?profile=63 into http://www.peacockgirls.com/profile/anna
  14. Chage the following URL : http://www.peacockgirls.com/index.php?profile=70 into http://www.peacockgirls.com/profile/sam
  15. Chage the following URL : http://www.peacockgirls.com/index.php?profile=61 into http://www.peacockgirls.com/profile/Larissa&Samantha
  16. Chage the following URL : http://www.peacockgirls.com/index.php?profile=54 into http://www.peacockgirls.com/profile/McKenzie
  17. Chage the following URL : http://www.peacockgirls.com/index.php?profile=29 into http://www.peacockgirls.com/profile/valery
If you show me 4 or 5 urls renaming techniques using .htaccess, I shall do remaining urls.

You can see every inner page url looks like a odd . Just like a index.php?page=2. I want to renaming those inner page with proper name. Waiting for your help !!!
#htaccess #redirection #url
  • Profile picture of the author teetot
    Hey mate,

    For the index page you can use

    RewriteRule ^$ /index.php?page=1 [L]

    From 2-8 you can use

    RewriteRule ^greece-escort$ /index.php?page=2 [L]

    For the rest you can use

    RewriteRule ^profile/aleena$ /index.php?profile=22 [L]

    Although ideally you want to do something like this and automate it:

    <?php
    $profile = $_GET['profle']; // Secure this obviously
    $data = $conn->prepare("SELECT username FROM users WHERE user=:profile");
    $data->execute(array('user' => $profile));
    // Obviously you have to connect to the database using PDO which wasn't included and you need to select the other data you need
    ?>

    Then you can just do

    RewriteRule ^profile/([^/]*)$ /index.php?profile=$1 [L]

    And replace 22 with aleena, and it will work for every profile you have...

    Hope this help any questions let me know
    {{ DiscussionBoard.errors[7779973].message }}
  • Profile picture of the author teetot
    I'd also point out I just took a quick look at your site and you can easily inject code into the website so I would probably fix that before you worry about URL structure...
    {{ DiscussionBoard.errors[7779976].message }}
  • Profile picture of the author seomanash
    I used following codes in .htaccess:-

    RewriteRule ^$ /index.php?page=1 [L]
    RewriteRule ^greece-escort$ /index.php?page=2 [L]

    At present your code is present in .htacces, but I can't see any changes in inner page.

    Let me know please, what should I do ?
    {{ DiscussionBoard.errors[7780352].message }}
    • Profile picture of the author teetot
      Originally Posted by seomanash View Post

      I used following codes in .htaccess:-

      RewriteRule ^$ /index.php?page=1 [L]
      RewriteRule ^greece-escort$ /index.php?page=2 [L]

      At present your code is present in .htacces, but I can't see any changes in inner page.

      Let me know please, what should I do ?
      You'll need to turn the rewrite engine on
      {{ DiscussionBoard.errors[7780426].message }}
  • Profile picture of the author seomanash
    Yes, I have done rewrite engine on
    {{ DiscussionBoard.errors[7783344].message }}

Trending Topics