![]() |
.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 |
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 |
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