Solved

Redirecting URLs using RewriteRule RewriteEngine in Apache .htaccess

Posted on 2012-03-23
2
380 Views
Last Modified: 2012-03-24
Using RewriteEngine's RewriteRule within Apache's .htaccess, I want to redirect urls containing this:
user_screenshots/4

To this:
user_screenshots/saves4/4

So for example, this url:
http://www.vizzed.com/vizzedboard/retro/user_screenshots/47040/Pokemon%20Yellow_Dec29%2021_37_35.png

Would get redirected to this:
http://www.vizzed.com/vizzedboard/retro/user_screenshots/saves4/47040/Pokemon%20Yellow_Dec29%2021_37_35.png
0
Comment
Question by:davideo7
2 Comments
 
LVL 12

Accepted Solution

by:
larsrohr earned 500 total points
ID: 37759858
How about this:

RewriteCond %{REQUEST_URI} .*user_screenshots/4.*
RewriteRule ^(.*)user_screenshots/4(.*)$ http://%{HTTP_HOST}$1user_screenshots/saves4/4$2 [R,L]

Open in new window

0
 

Author Closing Comment

by:davideo7
ID: 37760192
That worked perfect, thanks!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question