.htaccess - How can I rewrite specific URLs on an existing site to load pages from WordPress which is installed in a subdirectory? -
I have an existing site, which is created with CodeIgniter on example.com.
I have a WordPress install example.com/wp. The URLs look like this: example.com/wp/my-page
I am trying to explain that displaying contents of example.com/wp to example.com/my-page How to write / My-page while still showing URL as example.com/my-page
CodeIgniter controls the index.php file, so I can not use WordPress's index.php in the root.
I am halfway there, I have worked with a plain HTML file, but by joining WordPress, the URL can be rewritten in the / wp subdirectory.
Here's what I'm using Example.com root:
& lt; IfModule mod_rewrite.c & gt; Follow the ReturninIn On Options Time Links Reitibase / Reprocessor Rule ^ my-page / wp / my-page [P] & lt; / IfModule & gt;
When I go to example.com/my-page, at the end of the example / wp.
I think it has something to do with standard WordPress .htaccess / Wp / directory which looks like this:
# WordPress and lt; Ifmodule mod_rewrite.c & gt; RewriteBase / WP / RewriteRule ^ Index \ .php $ RewriteEngine On - [L] RewriteCond% {REQUEST_FILENAME} -f RewriteCond% {REQUEST_FILENAME} -d RewriteRule !. /wp/index.php [L] & lt; / IfModule & gt; #WordPress
I tried to add [P] flag to WordPress rules but no luck, I also / wp / P> The problem is that I do not understand the fact that to find out my problem or is it possible that it is possible.
In summary, I think without redirecting a rewrite URL (hence [P] flags).
Can this be done? Any help would be appreciated.
$ cat .htaccess
RewriteBase / RewriteRule ^ my-page wp / my-page [L]
$ tree- a wp
wp | - .htaccess `- index.php
$ cat wp / .htaccess
#WordPress & Lieutenant; IfModule mod_rewrite.c & gt; RewriteBase / WP / RewriteRule ^ Index \ .php $ RewriteEngine On - [L] RewriteCond% {REQUEST_FILENAME} -f RewriteCond% {REQUEST_FILENAME} -d RewriteRule !. /wp/index.php [L] & lt; / IfModule & gt; # END WordPress
$ cat wp / index.php
& lt; Pre & gt; & Lt ;? Php print_r ($ _ server)); ? & Gt; & Lt; / Pre & gt; Result: The URL displayed in the browser: http://example.com/my-page
Output: Array ([REDIRECT_REDIRECT_STATUS] = & gt; 200 [REDIRECT_STATUS] = & gt; 200 [HTTP_HOST] = & gt; example.com [HTTP_USER_AGENT] => Mozilla / 5.0 (Windows NT 6.1; WOW64; RV: 13.0) Lizard / 20,100,101 Firefox / 13.0.1 [HTTP_ACCEPT] => Text / html, application / xhtml + xml, application / xml; q = 0.9, * / *; q = 0.8 [HTTP_ACCEPT_LANGUAGE] = & gt; N us, n, cue = 0.5 [HTTP_ACCEPT_ENCODING] => gzip, air extract [HTTP_CONNECTION] = & gt; keep alive [path] => / usr / local / Bin: / usr / bin: / bin [SERVER_SIGNATURE] = & gt; Apache / 2.2.16 (Debian) for example Server Port 80 [ARPAS / AEPA = 2.2.16 (Debian) [SERVER_NAME] => [SERVER_ADDR] => for example 1.2.3.4 [SERVER_PORT]] => 80 [REMOTE_ADDR] = & gt; 4.3.2.1 [DOCUMENT_ROOT] = & gt; /www/vhosts/example.com/ [SERVER_ADMIN] = & gt; webmaster@example.com [SCRIPT_FILENAME] = & gt; / Www / vhosts /example.com/wp/index.php [REMOTE_PORT] => 57775 [REDIRECT _URL] = & gt; / Wp / my-page [GATEWAY_INTERFACE] = & gt; CGI / 1.1 [SERVER_PROTOCOL] = & gt; HTTP / 1.1 [REQUEST_METHOD] = & gt; [QUERY_STRING] = & gt; Get [REQUEST_URI] = & gt; / My page [SCRIPT_NAME] = & gt; /wp/index.php [PHP_SELF] = & gt; /wp/index.php [REQUEST_TIME] = & gt; 13420 9 1732) Therefore, if you are still seeing a redirect after this point, then this php code
< / Div>
Comments
Post a Comment