.htaccess - Rewrite URLs to redirect and drop leading zero -


I have two blogs on two different domains that I am strengthening on one site. I'm not even familiar with the server administrator, but I'm 99% sure what I want to do, is possible on the bluostost (since they allow .htaccess) and using mod_rewrite (or similar.)

I currently use the blog1.com and blog2.com and the URL post blog1.com/001 and blog2.com / 030 . What I want is for all those people who enter all the URLs that are example.com/blog1/1 and example.com/blog2/30

P> This means that I need it:

  1. Redirect entire domain to a folder on my new domain
  2. leading zero Without the URL redirect to the URL, / li>
  3. This may mean blog1.com/001 and example.com/blog1/001 to example redirect. Com / Blog 1/1

Renew

1 & amp; The second condition is fulfilled but the rule is not fire.

3 breaks completely and makes a strange return: http://example.com/blog1/030log1/030

  # blog redirection on revitting engine 1. Com / 030 = & gt; Example.com/blog1/30RivoConduct% {HTTP_HOST} ^ (?: Www.)? (Blog1 | blog2) \. [NC] REERRR 0 ^ ([1- 9] +) /? $ Http://example.com/%1/$1 [R = 301, L] # redirect example.com/blog1/030 = & gt; Example.com/blog1/30Revyctond% {HTTP_HOST} ^ (?: Www \.)? Example \ .com $ [nc] rewritable ^ (blog1 | blog2) / 0 * ([1- 9] +) /? $ / $ 1 / $ 2 [nc, r = 301, l] # Anytime www revalidament% {HTTP_HOST} ^ www (([a-z0-9_] + example.com) $ [nc] rewritable .http : //% 1% {REQUEST_URI} [R = 301, L]]  

You can use this code in your DOCUMENT_ROOT / .htaccess file in the blog1 and blog2 domain:

 < Code> Rewrite on rewriting engine% {HTTP_HOST} ^ (?: Www \.)? (Blog1 | blog2) \ [nc] rewriting rule ^ 0 * ([1- 9] +) /? $ Http: / /example.com/%1/$1 [R = 302, L] # rule2 for example: / blog1 / 030 => Example.com/blog1/30Revyctond% {HTTP_HOS T ^ ^ (?: Www.)? Example \ .com $ [nc] rewritable ^ (blog1 | blog2) / 0 + ([1- 9] +) /? $ / Code $ 1 / $ 2 [ Is a reference to  blog1  or  blog2  
  • % 1 or blog2 Code> these revoked code
  • ^ 0 * ([1-9] +) will match all leading zeros that are only non- $ 1 -oero numbers in

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -