I have a joomla site in my domain root, i.e www.myjoomlasite.com and I have a rails application in www.myrailssite.com/railsapp
I want to deploy the rails application in a sub-directory of http://www.myjoomlasite.com, expecting that rails application will be available in http://www.myjoomlasite.com/railsapp.
After doing all necessary steps when i click, www.myjoomlasite.com/railsapp in browser, it redirect me correctly to http://www.myjoomlasite.com/railsapp/admins/sign_in
Then in spite of displaying the sign_in page, it displayed joomla's error page "404 page not found"
My questions are:
If anything wrong with the rails application it should display rails
error page, but why joomla's error page?
In rails application production log why it showing Completed 401 Unauthorized in 1ms ?
How can i deploy rails application in a sub-directory of my joomla site?
Additional information:
rails application production log
Started GET "/railsapp" for 24.5.7.81 at 2012-09-14 08:41:36 -0700
Processing by HomeController#index as HTML
Completed 401 Unauthorized in 1ms
UPDATE
I have found the possible reason behind '404'. I have .htaccess file in document root. This .htaccess file stoping rails application to render.
Is it possible make some changes in .htaccess file show that, rails app can render properly?
There is a .htaccess file in document root. This default .htaccess file comes with joomla source code ( as htaccess.txt, letter is was renamed to .htaccess). There is one RewriteRule based upon some RewriteCond . All the rewrite condition, that are comes with default htaccess file, stopping my "/railsapp" url to render. To allow to pass my "/railsapp" i add following RewriteCond in .htaccess
RewriteCond %{REQUEST_URI} !^/railsapp
If any url start with 'railsapp' prefix, then those url will not rewrited by rewrite rule and visit that url directly.
Related
Currently i'm working on a backend website admin but i have some trouble with redirecting. The issue is this when someone wants to edit a specific job function he needs to be redirected to for example: jobs/edit/Webdeveloper and in the PHP script it will send in an action to go to the edit page but when i redirecting it, it stays on the same page and does a simply refresh.
This is what i have as an link tag:
<a href='".$adminurl."/jobs/edit/".$list["function"]."'>Change</a>
And it works out like this domain.com/admin/jobs/edit/Webdeveloper
This is what i have in my .htaccess
RewriteRule ^jobs/change/(.*) jobs.php?&action=change&job=$1
What am i doing wrong here?
I wanna set up an download page.
I need to access those pages only through a login page and stop all the direct access to the download page path and also its files and again if anyone tries to access those pages directly then it should automatically redirect to login page itself or else at least with a 404 error.
How can I do all these in .htaccess file. It will be very much helpful in developing my website.
Thanks in advance
Assuming that your all of your downloads are inside of a downloads directory, something like this should do the trick.
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https?://(?:www\.)?your.site.*
RewriteRule ^downloads\/?.* http://your.site/login [R=302,L]
Alternatively (and ideally) you should instead keep the pages outside of the site's root directory and download them through a proxy page.
I have a Joomla site running on Apache and Ubuntu 12.04. I wanted to show a custom 404 pages to be shown when a 404 error occure. I have made necessary changes to error.php file in my template directory to redirect it to '/404' directory where I have an index.html file with many images,css and java script.
Now when accessing a non-existent page, Joomla is redirecting me to root/404 but there I get a 403 Forbidden error from appache. The 404 directory is located inside 'htdocs' directory of Joomla installation.
Additional info:
1. I don't want to convert my 404 page into a Joomla template or article.
2. I am using a Joomla AMI from Bitnami on Amazon web service
If you redirect to a 404 page, you corrupt the error mechanism. The client will never get that 404 status, but a 200 on successful redirect to your error page.
Instead, you should modify your template's error.php to
send the 404 Not Found header
directly send the error page using readfile()
You might have to adjust the asset paths within your error page.
That's totally wrong, working with static pages does not mean that you have to overcome Joomla's routing.
You should either override the error Page view or use custom error pages.
Take a look at Joomla's documentation.http://docs.joomla.org/Custom_error_pages
Nibra was totally right about breaking the mechanism but still using a readfile() seems as an overkill.
Is is possible to secure a directory on Apache with a custom form? I have a directory full of static HTML files, it is basically a full static site. I want to secure this site with a password.
I know I can use .htaccess but I would much rather have a custom form/database to secure the site. I know how to code in PHP well enough to create the form, database and do the authentication. What I don't know is how to tell Apache to redirect to that form if the user is not authenticated.
UPDATE: I would be fine using other authentication modules. I'm looking for a system similar to IIS Forms authentication. If the user is not logged in, visiting any file in the directory will redirect to a login form. Once logged in they can view any of the files in the directory.
Pseudocode follows:
if user authenticated:
read a file and output into browser (or return 404)
else:
show the form
end
The following .htaccess will rewrite every request to .html files into index.php:
RewriteEngine on
RewriteCond %{REQUEST_URI} \.html$
RewriteRule \.html$ /index.php [QSA,L]
You'll find the requested .html filename in $_SERVER['REDIRECT_URL'].
(Most of known PHP frameworks uses this or similar approach. There isn't anything fancy in this.)
I have a wordpress application thats currently the only application on the domain.
Now in this application, I've just created a /presentations folder...
How can I present anything stored in just this /presentations folder from getting redirected...
Thank you
WordPress's .htaccess file only redirects if a file matching the request URI can't be found. Files in your /presentations folder should be unaffected.
If you're redirecting in some other way than the default WordPress .htaccess rules, we'll need to see the config for that.