Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Redirecting URLs using RewriteRule RewriteEngine in Apache .htaccess

Posted on 2012-03-23
2
Medium Priority
?
387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
larsrohr earned 2000 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

688 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