PHP Redirect 301 - .htaccess -


i redirect users 1 old page new page usinh php redirect code. found redirecting new page , hape specific page. code im using it´s not working:

<?php  header("http/1.1 301 moved permanently");  header("location: http://www.new-website.com");  ?> 

is there option specify sub-url new url?

edit

i tried using .htaccess it´s not working there. decided use way. anyway, possible this? way, tried 2 codes using .htaccess:

rewriterule ^stand/index.php(.*)$ https://%{http_host}/stand-carros-usados$1 [r=301,l]`  

and

redirect 301 stand/index.php(.*) https://%{http_host}/stand-carros-usados 

but none of them worked.

check if mod-rewrite active or not. in apache configurations, there should uncommented statement loadmodule rewrite_module modules/mod-rewrite.so. if commented, uncomment , restart server. after that, put following inside stand directory:

rewriteengine on rewriterule ^index\.php(.*)$ https://%{http_host}/stand-carros-usados$1 [r=301,l,nc] 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -