$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>redirect to https:my-sitewp-admin instead of https:my-sitewordpresswp-admin after options updating|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

redirect to https:my-sitewp-admin instead of https:my-sitewordpresswp-admin after options updating

matteradmin8PV0评论

I installed my plugin for one of my clients but I got a bug.

In my plugin settings page using the wordpress settings system, when I click on the submit button to activate a license key, the reditection is https://my-site/wp-admin/options-general.php?page=settings-my-plugin&tab=premium&action=activate

instead of https://my-site/wordpress/wp-admin/options-general.php?page=settings-my-plugin&tab=premium&action=activate

I searched the problem and this is the result :

echo '<form method="post" action="options.php">'; //initial code - wrong redirection

<input type="hidden" name="_wp_http_referer" value="/wordpress/wp-admin/options-general.php?page=settings-my-plugin&amp;tab=premium">//seems to be correct     

admin_url(); //write https://my-site/wordpress/wp-admin/


printf( '<form method="post" action="%soptions.php">', admin_url() ); //same redirection error

.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

wordpress/.htaccess

# BEGIN s2Member GZIP exclusions
<IfModule rewrite_module>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
    RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
    RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions
# BEGIN WordPress

# END WordPress

[root]index.php

<?php //include_once("wordpress/index.php"); ?>

So, how can I resolved this problem to match with any admin url ?

I installed my plugin for one of my clients but I got a bug.

In my plugin settings page using the wordpress settings system, when I click on the submit button to activate a license key, the reditection is https://my-site/wp-admin/options-general.php?page=settings-my-plugin&tab=premium&action=activate

instead of https://my-site/wordpress/wp-admin/options-general.php?page=settings-my-plugin&tab=premium&action=activate

I searched the problem and this is the result :

echo '<form method="post" action="options.php">'; //initial code - wrong redirection

<input type="hidden" name="_wp_http_referer" value="/wordpress/wp-admin/options-general.php?page=settings-my-plugin&amp;tab=premium">//seems to be correct     

admin_url(); //write https://my-site/wordpress/wp-admin/


printf( '<form method="post" action="%soptions.php">', admin_url() ); //same redirection error

.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

wordpress/.htaccess

# BEGIN s2Member GZIP exclusions
<IfModule rewrite_module>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
    RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
    RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions
# BEGIN WordPress

# END WordPress

[root]index.php

<?php //include_once("wordpress/index.php"); ?>

So, how can I resolved this problem to match with any admin url ?

Share Improve this question edited Jan 28, 2019 at 13:34 J.BizMai asked Jan 28, 2019 at 12:53 J.BizMaiJ.BizMai 9302 gold badges10 silver badges30 bronze badges 3
  • I don't know why you are making things complex, why don't you move WordPress installation to /WordPress/ instead of root folder. – Arvind Singh Commented Jan 29, 2019 at 9:10
  • @ArvindSingh, It´s my client´s project. The ex-developer do this because he kept an old version in a folder on the root as well. But I already resolved it. You can see the solution here. – J.BizMai Commented Jan 29, 2019 at 12:21
  • @J.BizMai, could you add the solution as answer here and mark it as solved. So ppl don't need to follow links to other forum(s) and see the question has an answer. – Charles Commented Jan 30, 2019 at 5:58
Add a comment  | 

1 Answer 1

Reset to default 0

The solution was :

  1. not use the index.php to include the folder /wordpress/
  2. not use wordpress/.htaccess
  3. use only .htaccess to point to subfolder

    <IfModule mod_rewrite.c> 
        RewriteEngine On 
        #https
        RewriteCond %{HTTPS} off 
        RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
        RewriteCond %{HTTP_HOST} ^(www.)?my-site$ 
        #point to subfolder
        RewriteCond %{REQUEST_URI} !^/wordpress/ 
        RewriteCond %{REQUEST_FILENAME} !-f 
        RewriteCond %{REQUEST_FILENAME} !-d 
        RewriteRule ^(.*)$ /wordpress/$1 
        RewriteCond %{HTTP_HOST} ^(www.)?my-site$ 
        RewriteRule ^(/)?$ wordpress/index.php [L] 
    </IfModule>
    
Post a comment

comment list (0)

  1. No comments so far