Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may create a PHP(or any other) script which will handle all pages which does not exist. It will detect the old URLs and return 301 redirect to new URL. </p> <p>If old URLs cannot be parsed by regexp, you will need to create a map, like this:</p> <pre><code>$urlMap = array( '/category1' =&gt; '/new-category1', '/category2' =&gt; '/new-category2' ); </code></pre> <p>and to look up the new URLs from it. If URL is not in map, then return 404 header or redirect to somewhere else..</p> <p>You can use the <code>ErrorDocument</code> directive to define custom 404 page:</p> <pre><code>ErrorDocument 404 /process-urls.php </code></pre> <p>You can get the path from <code>$_SERVER['REQUEST_URI']</code>.</p> <h3>Update</h3> <p>As suggested by @faa, you can use the <a href="http://httpd.apache.org/docs/current/rewrite/rewritemap.html" rel="nofollow"><code>RewriteMap</code></a> apache directive. You need to create a <em>txt</em> file which will map from old URLs to new ones, one mapping per row, space separated:</p> <pre><code>/category1 /new-category-1 /category2 /new-category-2 </code></pre> <p>Then, in your <strong>virtual host file</strong>, declare the map:</p> <pre><code>RewriteMap examplemap txt:/path/to/file/map.txt </code></pre> <p>And the rewrite rule(may be placed in <em>.htaccess</em>):</p> <pre><code>RewriteCond ${examplemap:%{REQUEST_URI}|0} !=0 RewriteRule ^(.*) ${examplemap:$1|/not_found.html} </code></pre> <p>This method is easier to maintain than putting 400 rewrite rules to <em>.htaccess</em>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload