Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
htaccess redirect to subdir
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- htaccess redirect to subdir
- « Previous
-
- 1
- 2
- Next »
Re: htaccess redirect to subdir
19-05-2014 12:03 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks Spraxyt. The following code will redirect to the 'catalog' directory any request that specifically asks for index.php, , but fails if index.php is not mentioned because it then inserts www. before the link address, causing a 'not found' error.
I am looking for the code to redirect all links to all files, not just the index file.
/*Options +FollowSymLinks -MultiViews
#Turn mod_rewrite on
RewriteEngine On
RewriteBase /
Redirect /index.php http://test.solarproject.co.uk/catalog/
Options +ExecCGI
AddHandler cgi-script .cgi .pl
I am looking for the code to redirect all links to all files, not just the index file.
Message 16 of 21
(585 Views)
Re: htaccess redirect to subdir
19-05-2014 1:39 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
That redirect is the mod_alias style which I think would loop for a same-server redirect from /.
Try the following .htaccess which uses mod_rewrite. The third RewriteCond prevents looping:
Do you have any content in /public/cgi-bin (which the second RewriteCond will avoid rewriting)?
David
Try the following .htaccess which uses mod_rewrite. The third RewriteCond prevents looping:
AddHandler cgi-script .cgi .pl
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.solarproject\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond %{REQUEST_URI} !^/catalog/
RewriteRule (.*) /catalog/$1
Do you have any content in /public/cgi-bin (which the second RewriteCond will avoid rewriting)?
David
David
Message 17 of 21
(585 Views)
Re: htaccess redirect to subdir
19-05-2014 10:01 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks David, I hadn't expected a reply overnight! - sadly your suggested htaccess code doesn't work for me.
Using that code, a request for http://test/solarproject.co.uk/index.php ; converts to test.solarproject.co.uk/index.php and throws up a '404not found' as the file is actually in the 'catalog' subdirectory.
A call for http://test.solarproject.co.uk/ converts to www.test.solarproject.co.uk/catalog and gives 'webpage not available'. If I remove the www then it finds the index file ok.
I have no content in cgi-bin, that line is left from the default .htaccess that was loaded in the server migration.
Does this give any clues?
Using that code, a request for http://test/solarproject.co.uk/index.php ; converts to test.solarproject.co.uk/index.php and throws up a '404not found' as the file is actually in the 'catalog' subdirectory.
A call for http://test.solarproject.co.uk/ converts to www.test.solarproject.co.uk/catalog and gives 'webpage not available'. If I remove the www then it finds the index file ok.
I have no content in cgi-bin, that line is left from the default .htaccess that was loaded in the server migration.
Does this give any clues?
Message 18 of 21
(585 Views)
Re: htaccess redirect to subdir
19-05-2014 5:48 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I think you might be having problems because you're editing the .htaccess file in the root directory. Try commenting that out and creating an .htaccess in /public (or rename the one I've just put there that has a .bob file extension).
Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵
Message 19 of 21
(585 Views)
Re: htaccess redirect to subdir
20-05-2014 12:33 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks Bob, using spraxyt's code in the /public directory has helped but not quite solved it.
If I call for http://test.solarproject.co.uk/index.php it works, inserting the required 'catalog' into the address.
But if I call http://test.solarproject.co.uk without specifying a file then it falls over because it then also inserts the prefix www
--i.e. http://www.test.solarproject.co.uk/catalog/
If we can stop it assuming it is a www address then I think we've cracked it.
Any idea how to achieve that?
EDIT....Something seems to have changed overnight, everything seems to be working now. I am now looking at it on a different PC so I wonder if I was getting some interference from the browser cache when i was testing last night.
Thanks for the help, great forum.
If I call for http://test.solarproject.co.uk/index.php it works, inserting the required 'catalog' into the address.
But if I call http://test.solarproject.co.uk without specifying a file then it falls over because it then also inserts the prefix www
--i.e. http://www.test.solarproject.co.uk/catalog/
If we can stop it assuming it is a www address then I think we've cracked it.
Any idea how to achieve that?
EDIT....Something seems to have changed overnight, everything seems to be working now. I am now looking at it on a different PC so I wonder if I was getting some interference from the browser cache when i was testing last night.
Thanks for the help, great forum.
Message 20 of 21
(585 Views)
Re: htaccess redirect to subdir
20-05-2014 12:02 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Glad to hear this works now.
Adding an unwanted www struck me as potentially browser related - trying to be helpful.
David
Adding an unwanted www struck me as potentially browser related - trying to be helpful.
David
David
Message 21 of 21
(585 Views)
- « Previous
-
- 1
- 2
- Next »
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- htaccess redirect to subdir