Solved

Redirecting URLs using RewriteRule RewriteEngine in Apache .htaccess

Posted on 2012-03-23
2
379 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
The viewer will learn how to count occurrences of each item in an array.

839 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