GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   .htaccess redirect, wildcard (https://gfy.com/showthread.php?t=957244)

zentz 03-07-2010 03:07 PM

.htaccess redirect, wildcard
 
Is there a wildcard that i can use if i want to redirect all urls containing /somedir/blabla/694 ?

example
Redirect 301 /somedir/blabla/694-some-link http://www.website.com/blabla/some-link
Redirect 301 /somedir2/blabla/694-some-other-link http://www.website.com/blabla/some-other-link
Redirect 301 /somedir3/blabla/694-some-third-link http://www.website.com/blabla/some-third-link

Basicly i want to remove "/somedirX" and "694-" from the urls. Is this possible to do this with 1 line of code or do i need 1 line for each url redirect?

Thank you

Kevsh 03-08-2010 12:21 AM

You can use regular expressions with redirects, so something like this - although I'm sure the syntax is not exactly correct, hopefully you get the idea:

Redirect 301 /somedir[0-9]*/694-(.*) http://www.website.com/blabla/$2

[0-9]* says to match any number between 0 and 9, zero or more times
(.*) matches any character, zero or more times
$2 will copy the contents matched by (.*) and preserve them

These links may be of some help:
http://www.gnc-web-creations.com/301-redirect.htm
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Iron Fist 03-08-2010 01:13 AM

One and done.


All times are GMT -7. The time now is 03:16 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc