0

I need to rewrite all links that are in the form of http://onlifestyle.org/(DIRECTORY)/catogory/post to be displayed in the browser in the form of http://onlifestyle.org/catogory/post but still hitting the resource at http://onlifestyle.org/(DIRECTORY)/catogory/post Thanks

user1796624
  • 2,535
  • 6
  • 30
  • 59
  • Take a look at similar [like this one](http://stackoverflow.com/questions/990392/htaccess-rewrite-to-redirect-root-url-to-subdirectory), [my answer here](http://stackoverflow.com/questions/17158767/url-rewriting-with-htacess/17751227#17751227) or google how to make fancy url's using htaccess. You redirect the ugly url to the fancy url and you internally rewrite the fancy url to the ugly url. You have to make sure that the redirect doesn't match the internally rewritten url by either using the END-flag on the rewrite or make them not match an other way. – Sumurai8 Jul 27 '13 at 20:26

1 Answers1

1

Internally redirect http://onlifestyle.org/catogory/post to http://onlifestyle.org/directory/catogory/post:

RewriteRule ^category/post/?$ /directory/category/post [L]

Change your URL from http://onlifestyle.org/directory/catogory/post to http://onlifestyle.org/catogory/post:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+directory/category/post/? [NC]
RewriteRule ^ /category/post [R=302,L]

If everything works change 302 to 301 if you wish.

Prix
  • 18,774
  • 14
  • 65
  • 127