.htaccess - Redirect all numbered PHP pages to home -


a legacy php site i'm replacing contains static numbered php file every pagination of content, is:

example.com/pictures-1.php

example.com/pictures-2.php

example.com/pictures-3.php . . .

example.com/pictures-x.php

where x can integer 999.

how set rewrite in .htaccess 301 redirect of above pages home, i.e. https://www.example.com?

thanks.

simple thing want is:

rewriteengine on rewritecond %{request_uri} ^/pictures-(\d+).php rewriterule ^.*$ http://example.com [l,r=301,nc] 

you can of course extend pass page rewritten using following:

rewriteengine on rewritecond %{request_uri} ^/pictures-(\d+).php rewriterule ^.*$ http://example.com?page=%1 [l,r=301,nc] 

there's handly little tool helps .htaccess @ http://htaccess.mwl.be/


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -