index.cfm append with SES URL in MURA - .htaccess

Recently working with MURA CMS with RAILO on UBUNTU. I am installing MURA in inner folder of root directory.
public_html >> website.
Following code added in .htaccess to rewrite URL to run website without index.cfm and website directory.
Options +FollowSymLinks
RewriteEngine On
DirectoryIndex index.cfm
RewriteRule ^$ /website/ [R]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^website/([a-zA-Z0-9/-\s]+)$ /website/index.cfm/$1 [PT]
So my url http://example.com/website/privacy/ rewrite as
http://example.com/website/index.cfm/privacy/
I think rewrite rule should work correctly as I have tried some online validator and giving me correct result but if run it into MURA it produce URL like
http://example.com/website/index.cfm/privacy/index.cfm
I am not sure who is adding last index.cfm (apache or mura) and this take me to 404 page everytime.
Please help... this driving me crazy..
Thanks,
Pritesh
UPDATE
I have same site setup with windows/IIS 7 under subfolder of root and work fine though, if that help

To take off index.cfm of the URL, you have to edit file settings.ini.cfm
To edit this file
go to Modules / File manager
Then tab Application Root
Select folder config
Then right click on settings.ini.cfm and edit
In this file, siteidinurls and indexfileinurls have to be at 0
siteidinurls=0
indexfileinurls=0
After change, you have to reload application by clicking on Reload application on the Settings menu at the top of the window.

Thanks Matt and Mael for spending time for this issue.
Finally figure it out that TOMCAT was causing issue and adding index.cfm at the end.
<url-pattern>/website/index.cfm/*</url-pattern>
Add above URL pattern in web.xml file and it start working fine.

Related

How do i change the .htaccess on cPanel's Online File Manager (ByetHost)?

I'm using ByetHost as my website's FTP service, i configure everything (besides uploading the stuff) via ByetHost's Vista Panel, which has a Online File Manager where i presume i could edit the .htaccess.
However when i arrive at the File Manager, i can't seem to find the .htaccess file, and there is also a lack of a Settings button too.
Here is what the File Manager looks like: (the htdocs is where all my website's stuff is at)
I know ByetHost and/or whatever this unknown File Manager is not well known, but i'd like to ask anyways if there's anyone that could help me on how to configure my .htaccess. I would appreciate it.
I had this issue too, and couldn't find any settings or otherwise.
So what I simply did was:
Just created a new file and named it .htaccess!
And a quick test, I put in the following to allow access to my .html pages without actually typing the extension:
RewriteEngine on
RewriteRule ^(.+)\.html$ /$1 [R,L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ /$1.html [NC,END]
And it worked successfully.

When trying to redirect using HTACESS, a string "/redirect:/" gets embedded with the url

I have setup two domains to point to the same hosting server. For eg: the domains be :
example1.com
example2.com
I have created a directory called 'home' in my root, and whenever the 2nd domain is accessed, it should get redirected to the home directory.
For eg: example2.com/post.php should get redirected to example2.com/home/post.php
I have done this by creating an htaccess file in my root directory with the following contents:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} example2.com$ [NC]
RewriteCond %{REQUEST_URI} !home
RewriteRule ^(.*)$ ./home/$1
This is working perfectly. Now, i have a second requirement where i need to redirect users to a php file (post.php) inside home directory whenever the user accesses the url example2.com/gallery/somestring.
So, i created a second htaccess file in my home directory and entered the following code:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^gallery/([^/]+)$ post.php?post=$1
But, whenever i try to access the url example2.com/gallery/somestring, it shows a strange 404 Not Found error :
The requested URL /home/redirect:/home/gallery.html/somestring/somestring was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Here. "redirect:" string is getting concatenated to the redirected URL somehow.
Can any one please give me some idea as to why its happening ??
I solved this problem. I am sharing this if any one gets into this same problem and finds this post. The problem was that there was a file gallery.html in my root folder. This was causing this error. Just delete this file or rename the file to some thing else. Thats it :)

Clean URLS/.htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA
Looking for feedback
Goal: I am trying to enable "Clean URLs" on a Drupal 7 site (such that example.com/?q=user resolves to example.com/user).
I've just spent way too long pouring through official Drupal docs and comments, to no avail, so any suggestions are greatly appreciated!
I have checked the box "Enable Clean URLs" in Drupal (/admin/config/search/clean-urls) and got the all-clear that the configuration options were saved. So now I am actually able to go to example.com/user and it does indeed display the same content as example.com/?q=user. What I want, however, is for example.com/?q=user to be rewritten in the URI as example.com/user.
The relevant .htaccess code is shown above, and my Apache conf appears to be properly configured.
Clean urls do indeed work but I kept getting errors until I found this
This saved my sanity:
disable Overlay module
go to Clean URLS
change URL from: /?q=admin/config/search/clean-urls
to: /admin/config/search/clean-urls
Then the Check box should appear
I was searching for this issue, the solution that work for me was that:
Left click on the wamp server icon and go to the apache.
Here sub menu will be opened, go to the apache modules and enable the rewrite_module.
now restart wamp server and then check your site.
Enable clean url will now be active.
there should be a closing bracket on your last line "]". Perhaps this is the source of your frustration?

.htaccess - How to hide the internal directory used by subdomains?

I installed a small FTP space for my classmates which allows them to upload school related documents to my server. After the files have been uploaded, they can be easily accessed via a subdomain i.e. ftp.mydomain.com
Everything is working fine, the files can be downloaded and everything works properly.
There are two things which still annoy me though:
If you enter ftp.mydomain.com you see Index of /my_internal_directory instead of something like Index of /
Once you enter a sub-directory and click the Parent Directory link it will redirect you to ftp.mydomain.com/my_internal_directory/ as well
Is there any way to hide my_internal_directory ?
This is the content of my .htaccess file so far:
RewriteEngine on
RewriteCond %{HTTP_HOST} ftp\.mydomain\.com
RewriteCond %{REQUEST_URI} !^/my_internal_directory/
RewriteRule ^(.*)$ /my_internal_directory/$1 [L]
Any help would be greatly appreciated.
If you are using linux server then you can remove read permission for folder my_internal_directory
If not resolve, try to add:
Options -Indexes
on top of the file.
If still doesnt resolve please post your .htaccess file... :)

.htaccess not working on my server

I'm working on my project and now I want to transfer it from my localhost to server. Everything seems to work fine, but .htaccess doesn't work.
The server should be suporting mod_rewrite and print_r(apache_get_modules()); shows mod_rewrite running.
But still, when I type myaddress.com/contact, it shows error 404.
Here is the .htaccess file, but it should be fine, since it runs on my localhost:
RewriteEngine on
RewriteRule ^adminator/?$ adminator/login.php [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&detail=$2 [L]
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L]
Do you have any idea?
Thanks, Mike.
Does the server allow .htaccess? It doesn't really have to.
Try other directives, ask your hosting provider, or check the configuration yourself if possible.
I tried testing your rules they should be fine on urls such as: http://myhost.com/test1 and http://myhost.com/test1/test2 result in requesting url: index.php?page=test1 and index.php?page=test1&detail=test2
So the problem is not your rules, it is your server setup somewhere. As Mewp said check your Apache config file, look for AllowOverride which should be enabled for .htaccess files to overriding default settings.
Ok, fixed it .. deep in the hostings settings, there was an option to activate it .. but I found it after 4 hours of looking around .. :P

Resources