HTACCESS Redirect Issue on WordPress with folder as root

Alles, was PHP betrifft, kann hier besprochen werden.

HTACCESS Redirect Issue on WordPress with folder as root

Postby Wezley.DC » 28. May 2015 06:29

Hi there,

This is my first post here, really desperate for an answer and fix to this....

I am experiencing some strange behavior on my HTACCESS file.

I have a WordPress blog installed at this location: http://www.domain.com/blog/

when I leave out the last / from the URL eg. http://www.domain.com/blog

the HTACCESS file redirects me here: http://www.domain.com/httpdocs/blog/ (404 page not found)

This URL should resolve to: http://www.domain.com/blog/

How can I achieve this with HTACCESS file?

Here is my HTACCESS File in the blog folder (WordPress Root):

Code: Select all
# BEGIN WordPress
    <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>
# END WordPress


Thanks in advance for the help
Wezley.DC
 
Posts: 4
Joined: 28. May 2015 06:05
Operating System: Windows

Re: HTACCESS Redirect Issue on WordPress with folder as root

Postby Nobbie » 28. May 2015 10:33

That must have a different reason, as there is NO pattern like "httpdocs" in that .htaccess. Apache cannot "invent" such a redirect.

P.S.: As far as i can guess, you did something wrong on wordpress installation. Probably you provided "httpdocs" in the URL or something else. Or maybe you moved/copied an existing wordpress installation? There is a file wp-config.php (or wp_config.php or wpconfig.php) in wordpress, which holds some basic informations about the installation. I think you will find something like http://www.domain.com/httpdocs in that file (what would be wrong), instead of http://www.domain.com. If i am right, edit that file and try to change that value and try again.
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04

Re: HTACCESS Redirect Issue on WordPress with folder as root

Postby Wezley.DC » 28. May 2015 11:06

Hi there,

Found the file wp-config.php and the line of code you are referring to:

Code: Select all
define('WP_HOME','http://www.domain.com/blog');
define('WP_SITEURL','http://www.domain.com/blog');


this code has been defined correctly.

I do have anther HTACCESS File in the httpdocs directory - below is the code:

Code: Select all
<IfModule mod_rewrite.c>
    RewriteEngine On
   RewriteCond %{HTTP_HOST} !^$
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTPS}s ^on(s)|
    RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^.*$ / [R=301,L]
</IfModule>

Options -Indexes

ErrorDocument 404 http://www.domain.com


The physical folder structure is as follows:

/public_html/domain.com/httpdocs/blog
Wezley.DC
 
Posts: 4
Joined: 28. May 2015 06:05
Operating System: Windows

Re: HTACCESS Redirect Issue on WordPress with folder as root

Postby Nobbie » 28. May 2015 11:12

Wezley.DC wrote:I do have anther HTACCESS File in the httpdocs directory - below is the code:


And why do you have this? Anyway, i still cannot see how "httpdocs" comes into the URL. Also there is no pattern like "httpdocs". Did you mix different wordpress installations or any other software installations?
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04

Re: HTACCESS Redirect Issue on WordPress with folder as root

Postby Wezley.DC » 28. May 2015 11:29

I have a static HTML5 page installed in route directory

Then in the blog directory I have WordPress Installed - i.e. Blog folder is root for WordPress
Wezley.DC
 
Posts: 4
Joined: 28. May 2015 06:05
Operating System: Windows

Re: HTACCESS Redirect Issue on WordPress with folder as root

Postby Wezley.DC » 28. May 2015 11:33

BTW, I have a separate HTACCESS File in the httpdocs folder because domain.com is not primary domain on the server - the server is a shared server with multiple domains
Wezley.DC
 
Posts: 4
Joined: 28. May 2015 06:05
Operating System: Windows

Re: HTACCESS Redirect Issue on WordPress with folder as root

Postby paulosebin » 02. September 2015 19:50

Is not there something wrong in the general configuration of Wordpress? Verified that the URL is correct index.php?
paulosebin
 
Posts: 3
Joined: 02. September 2015 19:29
Operating System: Windows


Return to PHP

Who is online

Users browsing this forum: No registered users and 46 guests