Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607520
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:42:54+00:00 2026-05-22T00:42:54+00:00

I am attempting to redirect & rewrite some dynamic PHP URL’s to pretty and

  • 0

I am attempting to redirect & rewrite some dynamic PHP URL’s to pretty and SEO friendly URLs. I have manged to do this successfully through .htaccess with the following code:

RewriteCond %{QUERY_STRING} ^somevar=green&nodescription=([a-zA-Z0-9_-]*)$
RewriteRule (.*) /green\/%1\/? [L,R=301]

RewriteRule ^green/([^/]*)/$ /script.php?somevar=green&nodescription=$1&rewrite=on [L]

This creates a somewhat pretty URL as follows:

 http://www.mysite.com/green/aA43-/

As I say, this works absolutley fine. Apart from one thing. The parameter nodescription contains a non-descriptive random set of letters, numbers and other characters.

I would like to rewrite the nodescription parameter to a more descriptive one. I understand that I can do this with a rewritemap through Apache. However, I have no experience at doing soemthing like this, and I’m not entirely sure where to start.

Normally I would simply alter script.php so that it contains more descriptive parameters, but this time I have no control over the script; I am pulling it from another site using cURL.

Can anybody give me an example of how to pull this off?

Thanks!

Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:42:54+00:00Added an answer on May 22, 2026 at 12:42 am

    Well, to answer my own question, to pull this off you need access httpd.conf file on your apache server. My shared hosting company didn’t allow access to this file (I doubt any would allow you access).

    So I bit the bullet and purchased a VPS. I will post the steps I took here in order to set the rewritemap up in the hope that it will help a lost soul 🙂 Ok, here goes…

    My VPS has WHM installed, so in WHM I went to:

    Server Configuration >> Apache Configuration >> Include Editor

    Pre Virtual Host Include >> All Versions

    This feature takes any text you put in and includes it in your httpd.conf file without worrying that it will be overwritten at a later stage. If you don’t have WHM on your server then you can add the text directly to your httpd.conf file; make sure it is outside and before any virtual hosts.

    OK, so I included the following map declaration and rewrite rule:

    #Map to redirect (swaps key and value)
    RewriteMap rwmap txt:/home/*/public_html/rdmap.txt
    
    <Directory /home/*/public_html/test>
    
    Options All -Indexes
    RewriteEngine on
    
    RewriteRule ^url/([^/]*)/$ /script.php?foo=${rwmap:$1|$1}&rewrite=on [L]
    
    </Directory>
    

    The actual map is a simple text file containing key/value pairs – you need to place this file in the directory declared in RewriteMap rwmap txt:/home/*/public_html/rdmap.txt.

    And there you go. Apache now rewrites my URLs for me and I now have some nice and pretty SEO optimized links thanks to my rewrite map! Hoorah!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a problem in which I'm attempting to redirect a URL based
I have a situation where I am attempting to port some big, complex python
Does attempting to develop some sort of game, even just as a hobby during
I have sort of a tricky problem I'm attempting to solve. First of all,
I have my PHP files stored under FreeBSD under this directory: /home/david/public_html/code/php In my
I'm attempting to issue a 301 redirect when a user requests http://www.mysite.com/Default.aspx to http://www.mysite.com/
I'm trying to redirect mobile users and am attempting the following, but it doesn't
I have written a small PHP file that gets the information that was posted
I am attempting to pull some information from my tnsnames file using regex. I
I've attempting to redirect to a custom error page (via a specific controller) to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.