mod rewrite - Redirect Rules for .htaccess File -


what code these redirects in .htaccess file?

www.site.com/books/ =====> www.site.com/movies/

www.site.com/books/title/ =====> www.site.com/movies/title.html

if need 301 redirect (and assuming htaccess file in root folder), these rules trick:

rewriterule ^books/$ http://www.example.com/movies/ [r=301,l] rewriterule ^books/title/$ http://www.example.com/movies/title.html [r=301,l] 

replace example.com domain name.
search here in s.o. also. there countless posts on how these redirections.

edit: dynamic titles second rule becomes:

rewriterule ^books/([^.]+)/$ http://www.example.com/movies/$1\.html [r=301,l] 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -