• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

Redirecting URLs using RewriteRule RewriteEngine in Apache .htaccess

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
davideo7
Asked:
davideo7
1 Solution
 
larsrohrCommented:
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
 
davideo7Author Commented:
That worked perfect, thanks!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now