• I thought that I had resolved this issue – but I had not so I am reposting
    Thank you in advance – here is an example of my issue:
    I have a subdomain media.abc.com. I set up a proxy server so that the user will see the site as abc.com/media
    in wp-config I set up

    /** Site URL */
    define( ‘WP_HOME’, ‘https://www.abc.com/media’ );
    define( ‘WP_SITEURL’, ‘https://www.abc.com/media’ );

    $_SERVER[‘REQUEST_URI’] = str_replace(“/wp-admin/”, “/media/wp-admin/”, $_SERVER[‘REQUEST_URI’]);
    The only link that doesn’t work properly is the link in wp-admin on the pages and posts It is the link to next pages and next posts on the bottom (or top) of those pages and it Does not work. Those links start at: https://media.abc.com/media/wp-admin/edit.php?… INSTEAD OF https://www.abc.com/media. It is not affected by site url setting changes which we set up. To try to fix this issue
    I added to the .htaccess
    RewriteEngine On
    RewriteRule ^media/wp\-admin/edit\.php$ https://anylaw.com/media/wp\-admin/edit.php? [L,R=301]

    And now this link refreshes to https://www.anylaw.com/media/wp-admin/edit.php
    and I cannot get to see the other 56 pages of posts that I have.
    What do you recommend?
    thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Dion

    (@diondesigns)

    Try the following for your rewrite rule:

    RewriteRule ^media/wp\-admin/edit\.php$ https://anylaw.com/media/wp-admin/edit.php [QSA,L,R=301]

    Note that other $_SERVER keys may need editing, such as HTTP_HOST, SCRIPT_FILENAME, and DOCUMENT_ROOT.

    Thread Starter newbee_sue

    (@newbee_sue)

    I tried your fix and it works on the one hand – I can now click from admin pages to see the next page However, I cannot it creates an erro and I cannot save new pages – I get a json error – Updating failed: the response is not a valid JSON response.

    Do you have any suggestions? thanks in advance
    I tested it on staging – here is the full htaccess code

    #when these two lines are in I can get to next page. but breaks saving pages. When I take it out the pages work again.
    RewriteEngine On
    RewriteRule ^staging/wp\-admin/edit\.php$ https://abc.com/staging/wp-admin/edit.php [QSA,L,R=301]
    
    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    # BEGIN rules managed by Control Panel > WordPress
    # !!kEjyblCcD/IsMQbsrbzoR8frKH0:eyJvcHRpbWl6ZSI6MX0=
    
    ### BEGIN Optimization enabled via Control Panel > WordPress ###
    <IfModule mod_deflate.c>
    	# Insert filters according to https://codex.www.ads-software.com/Output_Compression
    	AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-httpd-php application/x-httpd-fastphp image/svg+xml
    
    	# Drop problematic browsers
    	BrowserMatch ^Mozilla/4 gzip-only-text/html
    	BrowserMatch ^Mozilla/4\.0[678] no-gzip
    	BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    
    	# Make sure proxies don't deliver the wrong content
    	Header append Vary User-Agent env=!dont-vary
    </IfModule>
    
    ## LEVERAGE BROWSER CACHING ##
    <IfModule mod_expires.c>
    	ExpiresActive On
    	ExpiresByType image/jpg "access 1 year"
    	ExpiresByType image/jpeg "access 1 year"
    	ExpiresByType image/gif "access 1 year"
    	ExpiresByType image/png "access 1 year"
    	ExpiresByType text/css "access 1 month"
    	ExpiresByType application/pdf "access 1 month"
    	ExpiresByType application/x-javascript "access 1 month"
    	ExpiresByType application/javascript "access 1 month"
    	ExpiresByType application/x-shockwave-flash "access 1 month"
    	ExpiresByType image/x-icon "access 1 year"
    	ExpiresDefault "access 2 days"
    </IfModule>
    ## LEVERAGE BROWSER CACHING ##
    
    ### Skip 404 error handling by WordPress for static files ###
    <IfModule mod_rewrite.c>
    	RewriteEngine On
    	RewriteCond %{REQUEST_FILENAME} !-f
    	RewriteCond %{REQUEST_FILENAME} !-d
    	RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap\.xml(\.gz)?)
    	RewriteCond %{REQUEST_FILENAME} \.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
    	RewriteRule .* - [L]
    </IfModule>
    #### END Optimization enabled via Control Panel > WordPress ####
    
    # END rules managed by Control Panel > WordPress
    Dion

    (@diondesigns)

    Looking at the code in the wp_guess_url() function, it appears that you should also edit $_SERVER['HTTP_HOST'], $_SERVER['SCRIPT_FILENAME'], and $_SERVER['PHP_SELF']. Try that and see if it helps.

    Thread Starter newbee_sue

    (@newbee_sue)

    Thank you for your help. I am not exactly sure how to set this up. Please advise. the other thought was to use a javacript as follows `jQuery(‘a[href*=”staging.abc.com”]’).each(function()
    {
    var href = jQuery(this).attr(‘href’);
    var new_href = href.replace(‘staging.abc.com/staging’, ‘abc.com/staging’);
    jQuery(this).attr(‘href’, new_href);
    })`

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘proxy not working for admin edit.php links’ is closed to new replies.