Wordpress inside Cakephp

后端 未结 3 1979
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 15:27

I have installed Wordpress inside Cakephp\'s /app/webroot/blog/ folder and changed the wordpress permalink settings to Month and name (eg. http://abc.com/

相关标签:
3条回答
  • 2021-01-03 15:36

    There is no need to put the blog folder in webroot folder. You can access your folder by making slight changes in your .htaccess file. Just put your wordpress folder on root of cakephp with app folder and change .htaccess as given below.

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule (blog/.*) $1 [L] # adjust the regex to what you want.
        RewriteRule    ^$ app/webroot/    [L]
        RewriteRule    (.*) app/webroot/$1 [L]
    </IfModule>
    
    0 讨论(0)
  • 2021-01-03 15:46

    When we change the permalink settings of Wordpress, it generates a .htaccess file, if there is required permission else we have to create it.

    In the above case there was no .htaccess file inside /blog/ folder. I created it with the following mod_rewrite rules as provided by Wordpress while changing permalink settings.

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /blog/
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /blog/index.php [L]
    </IfModule>
    

    After this every thing works fine.

    0 讨论(0)
  • 2021-01-03 15:48

    I tried both the above codes but none work for me.. then i found something by my own and it worked..So here it is ,, hope this will help some.

    First Add the WordPress folder inside the webroot folder as blog. Inside blog paste the WordPress directories and files.. install the WordPress.. Now you will see in the WordPress admin general settings WordPress Address as http://cakephp/blog/app/webroot/blog, Change it to http://cakephp/blog. Save it ..

    Now look for the .htaccess file in WordPress install root folder change RewriteBase and RewriteRule (last one ) to RewriteBase /blog/ and RewriteRule . /blog/index.php [L]

    <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteBase /blog/
     RewriteRule ^index\.php$ – [L]
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule . /blog/index.php [L]
    </IfModule>
    
    0 讨论(0)
提交回复
热议问题