.htaccess Redirect Directory To Subdirectory

StackOverflower

I am attempting to redirect my page

http://example.com/category/general/

to

http://example.com/blog/category/general/

I thought that this would work but it ends up endlessly looping

RedirectMatch 301 /category/general/ /blog/category/general/
anubhava

You must use regex anchors as well:

RedirectMatch 301 ^/category/general/?$ /blog/category/general/

And with capturing groups:

RedirectMatch 301 ^/(category/general/?)$ /blog/$1

Test this after clearing your browser cache.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

.htaccess redirect to subdirectory of directory

From Dev

.htaccess - redirect from subdirectory to root directory and remember in enviroment requested path

From Dev

htaccess redirect all files in the root directory to coresponding pages in subdirectory

From Dev

htaccess - check if files exist in current directory and subdirectory, if not redirect to 404 page

From Dev

.htaccess redirect from subdirectory to parent directory file but maintain url path

From Dev

.htaccess redirect to subdirectory

From Dev

htaccess redirect error to a subdirectory

From Dev

htaccess prevent redirect in subdirectory

From Dev

htaccess redirect phpbb to subdirectory

From Dev

Redirect from a directory to a subdirectory

From Dev

htaccess redirect from top to subdirectory

From Dev

htaccess Redirect subdirectory and its contents

From Dev

want to redirect subdirectory from htaccess

From Dev

.htaccess 301 redirect - rename subdirectory

From Dev

How to redirect to subdirectory using .htaccess?

From Dev

want to redirect subdirectory from htaccess

From Dev

Complex .htaccess redirect from subdirectory

From Dev

Use htaccess in subdirectory to redirect page

From Dev

Allow .htaccess to Subdirectory of a Blocked Directory

From Dev

Htaccess some directory, subdirectory usage

From Dev

.htaccess hide subdirectory url after redirect

From Dev

.htaccess 301 Redirect all content except for subdirectory

From Dev

.htaccess redirect domain to subdirectory without changing URL

From Dev

.htaccess on redirect loop when changing subdomain to subdirectory

From Dev

htaccess infinite redirect on password-protected subdirectory

From Dev

htaccess redirect from site built in a subdirectory

From Dev

How to redirect root to subdirectory using .htaccess

From Dev

How to redirect to another subdirectory with same name with .htaccess

From Dev

Redirect subdirectory to root URLs using .htaccess

Related Related

  1. 1

    .htaccess redirect to subdirectory of directory

  2. 2

    .htaccess - redirect from subdirectory to root directory and remember in enviroment requested path

  3. 3

    htaccess redirect all files in the root directory to coresponding pages in subdirectory

  4. 4

    htaccess - check if files exist in current directory and subdirectory, if not redirect to 404 page

  5. 5

    .htaccess redirect from subdirectory to parent directory file but maintain url path

  6. 6

    .htaccess redirect to subdirectory

  7. 7

    htaccess redirect error to a subdirectory

  8. 8

    htaccess prevent redirect in subdirectory

  9. 9

    htaccess redirect phpbb to subdirectory

  10. 10

    Redirect from a directory to a subdirectory

  11. 11

    htaccess redirect from top to subdirectory

  12. 12

    htaccess Redirect subdirectory and its contents

  13. 13

    want to redirect subdirectory from htaccess

  14. 14

    .htaccess 301 redirect - rename subdirectory

  15. 15

    How to redirect to subdirectory using .htaccess?

  16. 16

    want to redirect subdirectory from htaccess

  17. 17

    Complex .htaccess redirect from subdirectory

  18. 18

    Use htaccess in subdirectory to redirect page

  19. 19

    Allow .htaccess to Subdirectory of a Blocked Directory

  20. 20

    Htaccess some directory, subdirectory usage

  21. 21

    .htaccess hide subdirectory url after redirect

  22. 22

    .htaccess 301 Redirect all content except for subdirectory

  23. 23

    .htaccess redirect domain to subdirectory without changing URL

  24. 24

    .htaccess on redirect loop when changing subdomain to subdirectory

  25. 25

    htaccess infinite redirect on password-protected subdirectory

  26. 26

    htaccess redirect from site built in a subdirectory

  27. 27

    How to redirect root to subdirectory using .htaccess

  28. 28

    How to redirect to another subdirectory with same name with .htaccess

  29. 29

    Redirect subdirectory to root URLs using .htaccess

HotTag

Archive