• [second posting—please help or at least give me a pointer. thanks.]

    I’m probably missing something simple but I’m unable to get redirects working for files with a .php extension. Other files, whether they have .htm or .html extensions redirect fine. I thought this had to do with the existing wordpress rewrite rules but deleting them changed nothing.

    I’m working in a beta directory that is protected (monthlyreview.org/_beta01). The files don’t even exist in this directory, they are in root but this shouldn’t matter according to the documentation (plus the .htm redirects work fine).

    What is it about the .php extension that is causing the problem? Any help is much appreciated.

    P.S. I’ve messed with the options quite a bit to no avail. And I’ve also searched the documentation.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Jamil Jonna

    (@jonna)

    Again, whenever I try and redirect a URL with a .php extension, it simply doesn’t work. URLs with .htm or .html extensions work fine but .php redirects simply break. Do I have to use RegEx to redirect these URLs?

    redirect source: /_beta01/598einst.php (if .php is changed to .htm it works fine)
    redirect: /_beta01/blog/magazine/1998/05/01/why-socialism-2

    error:
    You've submitted a request for a file that does not exist on this server. Please correct your URI and try, try again. (none) 71.193.180.187 /_beta01/598einst.php monthlyreview.org Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 404

    Many thanks ahead of time…

    J

    Hey Jamil,

    Did you ever find out what the problem was? I’m having the exact same problem with my .htaccess file. I can redirect html pages but I can’t seem to redirect php pages.

    Plugin Author John Godley

    (@johnny5)

    No, Redirection doesn’t need anything special for .php files. More than likely your web server is grabbing the URL before Redirection has a chance and trying to run it as a PHP file. You will need to reconfigure your server to change this behaviour.

    Thread Starter Jamil Jonna

    (@jonna)

    @john: that’s a vague reply—can you clarify?

    I’m still not sure what the problem is but I think it something to do with the fact that my site is password protected at the moment because it is in beta.

    If it does have something to do with the server configuration then what should be changed? Obviously the site is handling the PHP files for WordPress just fine: what makes this different?

    Jamil

    Plugin Author John Godley

    (@johnny5)

    Well… pretty much what I said! Your web server (Apache, for example) is configured to handle .php files itself. It is probably handling .php files itself before it passes them on to PHP and WordPress. I can’t say what exactly you’ll need to change as it could be any number of configuration issues, but have a look in your .htaccess file and your server config.

    Thread Starter Jamil Jonna

    (@jonna)

    Can you explain, then, why .php redirections work fine in non-wordpress directories? In other words, I’m making 301 redirects using .htacces in another directory (and they are specific redirections, not rules). There are no rewrite rules for PHP files, only 301 redirects, mostly from .htm to .php but some .php to .htm.

    Here are some examples (keep in mind, this is in my root directory, not the _beta01 directory I’m using for building the new site):

    Redirect 301 /598einst.php http://www.monthlyreview.org/598einstein.php
    Redirect 301 /0902achcar.htm http://www.monthlyreview.org/
    Redirect 301 /0506tiger.htm http://www.monthlyreview.org/0506tigar.htm

    Aside from some rewrite rules dealing with a specific subdirectory, this is all that exists in .htaccess:

    RewriteEngine on
    #Options All -Indexes
    
    #IndexIgnore .htaccess 
    
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    
    Options -Indexes +FollowSymLinks

    In the wordpress (i.e. ‘_beta01’) directory, this is all that is in .htaccess (that is relevant):

    RewriteEngine On
    RewriteBase /_beta01/
    RewriteRule ^index\.php$ - [L]
    
    # BEGIN WordPress
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

    If the above isn’t relevant and basic server configurations conflict with Redirection, there should be some documentation on the issue. I don’t have my server set up in any special way—the site is hosted by a large company, with the ubiquitous Cpanel backend.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Redirection] Files with .php extension won't redirect’ is closed to new replies.