Jump to content

Conditional Rewrites


KiltedMike

Recommended Posts

I've searched and read 'til my head is spinning, but I just can't find an answer to this situation.  It has to have been discussed many times before...I just can't find it:

 

I have a large number of html pages that have been converted to php (MySQL database), such as:

 

123.html  becoming  EventRecord.php?Id=123

 

I also have many static html pages remaining.

 

Is it possible to filter a mod_rewrite so that it only rewrites URLs that are numeric?  1.html to 9999.html and nothing else?

 

The idea, of course, is to have these as 301 redirects.

 

Thanks!!

Link to comment
Share on other sites

this is basic pseudo code.

and I'm a little rusty with rewrites.

 

RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} -f
RewriteCond %{SCRIPT_FILENAME} \.html
RewriteRule (\d){,4}\.html $1.php [R=301]

 

Shouldn't need anything too complex for this, based off of your OP.

Link to comment
Share on other sites

  • 5 weeks later...

Took a long time trying to understand this, but I'm not gonna get there.  I've never needed mod_rewrite before and the odds are -- at 58 -- I'll die without needing it again.

 

Is there some place where I can hire someone to do this?  It should be a 5 minute piece of cake for someone who knows this stuff, but I have spent far too much time trying to learn it for the small need I have.  My time needs to be spent finding a new position since I've been laid off.

 

Appreciate the answer I got...just can't get from there to where I need to be.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.