Jump to content

PW in subdirectory


hellomoto
 Share

Recommended Posts

I have web hosting with the following .htaccess en root, to point it to a subdirectory "audino.us", wherein I have PW installed:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?something.com$
RewriteCond %{REQUEST_URI} !^/something.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /audino.us/$1
RewriteCond %{HTTP_HOST} ^(www.)?something.com$
RewriteRule ^(/)?$ something.com/index.php [L]

RewriteCond %{HTTP_HOST} ^(www.)?something.com$
RewriteRule ^(/)?$ something.com [L]

However when I go to audino.us/pw to access the admin, it becomes audino.us/audino.us/pw, and doesn't allow me to log in. How do I render the above to be recursive (?), i.e., to apply to all subordinate URLs? Is this to be done within the .htaccess in /audino.us, or in the root .htaccess above? Please help, I can't log in. Thanks much.

Link to comment
Share on other sites

Normally you just have to customize RewriteBase.

http://processwire.com/docs/tutorials/troubleshooting-guide/page3

(Or) doesn't your hosting provider ("panel") allow you to point your website to a sub-directory?

NB: http://domainname.tld/index.php should redirect to http://domainname.tld/, shouldn't it?
And, for SEO at least, the non-www version should redirect to the www version (or the contrary). Perhaps you have planned to do it later.

PS: for security reasons, perhaps you should "hide" the domain name of your website if it's still in development mode.

  • Like 1
Link to comment
Share on other sites

I have RewriteBase / in the PW htaccess, so / but:

  • / => example.com
  • /pw => example.com/example.com/pw/
  • /pw/ => example.com/pw/ ^-^
  • www. => www.example.com/example.com/
    (root links also = "", as opposed to www.example.com

 

How can I fix this?

root .htaccess =

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www.)?example\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(www\.)?example\.com/?(.*)$ http://example.com/$1 [R]
RewriteCond %{HTTP_HOST} ^(www.)?example\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /example.com/$1 [L,QSA]

 oh and so much for hiding the domain I did just because you said but you didn't but that's a ok

Link to comment
Share on other sites

Now I have 

RewriteEngine on
RewriteBase /

RewriteRule ^index.php$ / [NC,R,L]

# remove double/more slashes in url
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?audino\.us$ [NC]
#RewriteBase /audino.us
RewriteRule !^audino\.us/ /audino\.us%{REQUEST_URI} [L,NC]
# above 2 lines same effect

and in site/ready.php $config->urls->root = '/'; thus:

  • ^(www.)?example.com => example.com/example.com/
  • ^(www.)?example.com/pw, ^(www.)?example.com/pw/ => example.com/pw/

How to remedy this?
Also I am still unable to login; I've tried resetting the password via API in case I had it wrong.

Link to comment
Share on other sites

Please try with a fresh .htaccess file (in the sub-directory(?)). Disable the (lines you have added in the) .htaccess file you have in the root(?).

# 11.

RewriteBase /audino.us/

# 13.

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

If you want to redirect to the "www." version of the site (and not the opposite).

Don't put anything in ready.php related to this problem.

With some web hostings you can just point the website to a sub-directory from within their administrations. You don't need to touch RewriteBase.

Link to comment
Share on other sites

RewriteEngine on
RewriteBase /

RewriteRule ^index.php$ / [NC,R,L]

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

# mask primary domain subdir. location
RewriteCond %{HTTP_HOST} ^(www\.)?audino\.us$ [NC]
RewriteRule ^(.*)$ /audino\.us%{REQUEST_URI} [L,NC,QSA]

The above seems effective overall, except that (www.)?example.com/example.com(.*) need hide that tricky subdirectory from the URI.

Also I need to know how to either force or omit the www. prefix while also pointing to & hiding the subdirectory serving the site.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...