.htaccess - htaccess Redirect 301 to new url with dynamic subdomain,protocol -


i want redirect old url new url this:

redirect 301 www.domain.ro/index.php www.domain.ro/ 

but in case have dynamic subdomain , , don't know how build line:

redirect 301 www.domain.subsdomain.ro/index.php www.domain.subsdomain.ro/ 

now,besides subdomain dynamic, protocol can http or https , user can type in www or not, line like:

redirect 301 domain.{*}.ro/index.php domain.{*}.ro/ 

{*} - wildcard matches every alphabetic char between dots

you don't meed use domain name in target when same source url. besides cannot main host name in redrect directive.

just use rule using mod_rewrite remove index.php:

rewriteengine on  rewritecond %{the_request} /index\.php[?\s] [nc] rewritecond %{request_uri} ^(.*/)index\.php$ [nc] rewriterule ^ %1 [l,r=301,ne] 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -