Solved

Redirecting URLs using RewriteRule RewriteEngine in Apache .htaccess

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
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…
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now