Note that there are some explanatory texts on larger screens.

plurals
  1. POmod_rewrite to direct some requests to a new directory
    text
    copied!<p>I have a website with a frontend and a backend that all run through index.php. To access the back end you would go to <a href="http://www.mysite.com/Admin" rel="nofollow">http://www.mysite.com/Admin</a>. This will still run through index.php but then connect to the database and go to the correct directory. The backend manages donation information that is collected on the site.</p> <p>I want to change the front end to WordPress but still collect donation information in the original database and view it from the backend. </p> <p>Rather than rewrite all the code, I was wondering if there was a way I could use mod-rewrite and place the WordPress files in a separate directory. This way any request that included /Admin as the start would go through the original index.php and any other request would redirect to directory with WordPress.</p> <p>I originally tried:</p> <pre><code>RewriteCond %{REQUEST_URI} !^/Admin RewriteRule ^(.*)$ gpf/$1 [L] </code></pre> <p>but a request for /Admin just gives me a 404 error.</p> <p>Thanks in advance for any help.</p> <p>This is the full .htaccess file</p> <pre><code>RewriteEngine On Options -Indexes # Serve 'gate' as php &lt;Files gate&gt; SetHandler application/x-httpd-php AcceptPathInfo On &lt;/Files&gt; FileETag MTime Size AddCharset UTF-8 .xml AddType video/mp4 mp4 m4v AddType audio/mp4 m4a AddType video/ogg ogv AddType audio/ogg ogg oga AddType video/webm webm # redirect all domains (.net, .com, .biz, etc) to .org RewriteCond %{HTTP_HOST} !^www\.mysite\.org$ [NC] RewriteRule ^(.*)$ http://www.mysite.org/$1 [R=301,L] # Route search RewriteRule ^search$ /search/ [R,NC,L] RewriteCond %{REQUEST_URI} !^/Admin RewriteRule ^(.*)$ gpf/$1 [L] # Route domain plus slash correctly RewriteRule ^$ /gate/ [L] # All requests: serve _gate_ as php. 1st arg is requested URL qs preserved RewriteRule ^([0-9A-Z].*) /gate/$1 [QSA,L] RewriteRule ^rss\.xml /gate/rss.xml [QSA,L] # PHP directives - should comment out on production server php_value display_errors 1 php_value display_startup_errors 1 AddOutputFilterByType DEFLATE text/html application/x-javascript text/css text/javascript text/plain &lt;IfModule mod_expires.c&gt; ExpiresActive On # Manually change filenames for static images. CMS changes names in dyn ExpiresByType image/gif "access plus 9 months" ExpiresByType image/jpg "access plus 9 months" ExpiresByType image/jpeg "access plus 9 months" ExpiresByType image/png "access plus 9 months" # Rare changes. manually change filename ExpiresByType image/x-icon "access plus 9 months" ExpiresByType image/vnd.microsoft.icon "access plus 9 months" # PDFs should never change. CMS renames in dyn ExpiresByType application/pdf "access plus 6 months" ExpiresByType application/x-pdf "access plus 6 months" # Frequent changes. ASFU dynamic rename ExpiresByType text/css "access plus 6 months" ExpiresByType text/javascript "access plus 6 months" ExpiresByType application/x-javascript "access plus 6 months" &lt;/IfModule&gt; </code></pre>
 

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