Can't generate pretty URLs in Owncloud - .htaccess

In the officiall documentation for Owncloud 9 it says:
'htaccess.RewriteBase' => '/',
To have clean URLs without /index.php this parameter needs to be configured.
After setting this value run occ maintenance:update:htaccess [...]
However, running "occ maintenance:update:htaccess" will result in an error:
There are no commands defined in the "maintenance:update" namespace.
Can I update my .htaccess file manually?

I have just read on the #owncloud IRC at freenode.net that the maintenance:update:htaccess command will be available in the next minor version: 9.0.3
Apparently the documentation has been updated before the code itself.
In the meantime, you can indeed edit .htaccess yourself.
On my installation I would do:
sudo nano /var/www/owncloud/.htaccess
Then, in the last section of the file update the RewriteBase line to look like:
RewriteBase /owncloud

Related

How can i get mod_rewrite and .htaccess working with cakephp?

I'm trying to get cakephp working locally on my mac - yosemite. I have apache and php working locally in my /~user/Sites directory... I can hit a php ini file ok and have an install of wordpress in another directory.
I've hooked it all up apart from getting the urls rewriting... I followed the steps on the cake site:
http://book.cakephp.org/2.0/en/installation/url-rewriting.html
Now all I get is 404 not found!.
The three .htaccess files have the default content with an additional RewriteBase pointing to the folder its installed in, in my Sites folder.
Any ideas what I'm doing wrong? I've read the other posts on this and none of them helped!
Thanks
First, confirm mod_rewrite is enabled by (on command line):
# a2enmod rewrite
If it just got enabled using the command above, restart apache:
# /etc/init.d/apache2 restart
These types of errors should hit your error.log .. while trying to load the site, hold the error log open:
# tail -f /var/log/apache/error.log
and try to access your page again.
If this doesn't help you solve the problem, paste in your rewrite rules so we can take a peak.

New Apache Server - Trouble with .htaccess

(Pardon me, I've injured my right hand so I'll have trouble typing)
I've recently set up a new Linux server running off the 'LAMP Stack'. I used PuTTY, Git and friends. Usually, I work in a pre-set up environment - I'm just an app developer. This would technically count as my first 'solo venture'. I've never been given root access to a server before, I was just there to work.
So, to get started, I decided to port some of my work from a previous project and build off of that. It relies heavily on Rewrite Rules. Ignorantly, I assumed my .htaccess file would magically work. It doesn't - For whatever reason, Apache wants you to enable the use of rewrite rules (It's not like you'd accidentally set up an .htaccess file, dear me).
So, I've read various tutorials, followed guides, asked elsewhere - I'm not really getting anywhere. To finally get to the point, here's what I've done:
1. I enable the use of .htaccess files at /etc/apache2/sites-available/default-ssl.conf:
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
2. I create an .htaccess file at var/www/html/site:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/site/index.php [L]
3. Now, you should be able to reach a URL located at http://www.example.com/site/index.php/Bool via http://www.example.com/Bool (Bool is something like a query string - A page identifier). You can't in this case - You're told that there's no file titled 'Bool' on the server.
The rewrite rules given in section 2 have worked before, but don't work here.
Some guides also tell you to do wacky stuff like set up some password system at /etc/htaccess/.htpasswd and have another .htaccess file to call on that or something. Despite my other rewrite rules not working in this new server environment, the 'password' system did actually work (I was asked to provide a password before accessing a page) - However, I don't need or want any restricted access pages like that.
Practically everything I've tried has not worked - And that's ranged from changing the path in the <Directory> tag within default-ssl.conf to putting .htaccess files here and there, with and without password systems, different 'code' in the .htaccess/configuration files, and more. Practically every 'guide' provides you with a different solution, including and excluding details and steps others do/don't.
I've even attempted changing AllowOverride to All in /etc/apache2/apache2.conf to no success - Just an Internal Server Error.
The grand question: How do you enable the use of .htaccess files anywhere you need them? Somebody has to be using a correct configuration somewhere, so you happen to have that working on your server, I'd like to see what you did.
I'm very excited to be in charge of my own server, it's been a wonderful learning experience and surprisingly, the learning curve hasn't been too difficult. I hope I can get this app running on it properly.
If Unfortunately Your HtAccess File are not being read by your server even in any case then you can use this command in order to enable the htaccess accessibity onto your server.
TO ENABLE HTACCESS FILE ON RACKSPACE SERVER(Debian Os)
sudo a2enmod rewrite
and restart the apache server now it will be accessible.
Thanks
Raghwendra Pathak

.htaccess not working on localhost with XAMPP

i m using XAMPP but i m not able to use .htaccess file at local host. i m trying so many times.. Online working good. but local host showing [The requested URL was not found on this server]
My root folder is real
localhost/acre/real/property_available.php
localhost/acre/real/properties
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /acre/real/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^properties$ /property_available.php/$1 [NC,QSA]
</IfModule>
Please
Just had a similar issue
Resolved it by checking in httpd.conf
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All <--- make sure this is not set to "None"
It is worth bearing in mind I tried (from Mark's answer) the "put garbage in the .htaccess" which did give a server error - but even though it was being read, it wasn't being acted on due to no overrides allowed.
In conf/extra/httpd-vhosts.conf, add the line AllowOverride All for all the websites that you are having problem with
<VirtualHost example.site:80>
# rest of the stuff
<Directory "c:\Projects\example.site">
Require all granted
AllowOverride All <-----This line is required
</Directory>
</VirtualHost>
Try
<IfModule mod_rewrite.so>
...
...
...
</IfModule>
instead of <IfModule mod_rewrite.c>
Without seeing your system it's hard to tell what's wrong but try the following (comment answer if these didn't work WITH log error messages)
[STOP your Apache server instance. Ensure it's not running!]
1) move apache server/install to a folder that has no long file names and spaces
2) check httpd.conf in install\conf folder and look for AccessFileName. If it's .htaccess change it to a file name windows accepts (e.g. conf.htaccess)
3) double-check that your htaccess file gets read: add some uninterpretable garbage to it and start server: you should get an Error 500. If you don't, file is not getting read, re-visit httpd.conf file (if that looks OK, check if this is the only file which defines htaccess and it's location and it does at one place -within the file- only; also check if both httpd.conf and htaccess files are accessible: not encrypted, file access rights are not limited, drive/path available -and no long folder path and file names-)STOP Apache again, then go on:
4) If you have IIS too on your system, stop it (uninstall it too if you can) from services.msc
5) Add the following to the top of your valid htaccess file:
RewriteEngine On
RewriteLog "/path/logs/rewrite.log" #make sure path is there!
RewriteLogLevel 9
6) Empty your [apache]\logs folder (if you use another folder, then that one :)
7) Check the following entries are set and correct:
Action application/x-httpd-php "c:/your-php5-path/php-cgi.exe"
LoadModule php5_module "c:/your-php5-path/php5apache2.dll"
LoadModule rewrite_module modules/mod_rewrite.so
Avoid long path names and spaces in folder names for phpX install too!
8) START apache server
You can do all the steps above or go one-by-one, your call. But at the end of the day make sure you tried everything above!
If system still blows up and you can't fix it, copy&paste error message(s) from log folder for further assistance
I had a similar problem. But the problem was in the file name '.htaccess', because the Windows doesn't let the file's name begin with a ".", the solution was rename the file with a CMD command. "rename c:\xampp\htdocs\htaccess.txt .htaccess"
for xampp vm on MacOS capitan, high sierra, MacOS Mojave (10.12+), you can follow these
1. mount /opt/lampp
2. explore the folder
3. open terminal from the folder
4. cd to `htdocs`>yourapp (ex: techaz.co)
5. vim .htaccess
6. paste your .htaccess content (that is suggested on options-permalink.php)
For windows user, make sure to closely look at this section.
RewriteRule ^properties$ /property_available.php/$1 [NC,QSA]
As said in Apache documentation :
The mod_rewrite module uses a rule-based rewriting engine, based on a
PCRE regular-expression parser, to rewrite requested URLs on the fly.
So ^properties$ means Apache will only look for URL that has exact match with properties.
You might want to try this code.
RewriteRule properties /property_available.php/$1 [NC,QSA]
So Apache will see the URL that has properties and rewrite it to /property_available.php/
I've setup xampp for my localhost as well, I've not done anything with the files created by xampp during or after setup.
But in the '.htaccess' file, make sure you've set it to something like this. Works for me, and this should not make any difference for you.
RewriteEngine On
RewriteRule ^filename/?$ filename.html
Change .html to whatever format you're using.
Make sure your install is clean, and just make the .htaccess file.
Also remember to put one .htaccess file for each directory (don't really know if you can use ONE file for all folders, but to be safe, just do this and it will always work.
Edit the .htaccess file, so the first line reads 'Test.':
Test.
Set the default handler
DirectoryIndex index.php index.html index.htm
...

500 Internal Server Error when using .htaccess with RewriteEngine

I am on the shared host Bounceweb and I am trying to add some rewrite rules to make my links look prettier.
One of these rules is to make the url: http://mysite.com/upload point to: http://mysite.com/upload.php. I have this in my .htaccess file:
RewriteEngine on
RewriteRule ^upload$ upload.php
but all it's giving me is a 500 Internal Server Error. I looked at my logs and this comes up a lot:
[alert] [client 81.179.29.185] /home/minecraf/public_html/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Does this mean my host doesn't support .htaccess? Pretty lame if they don't. I've already tried changing the permissions of .htaccess to 777 and it doesn't help.
Thanks!
\xef\xbb\xbf are three invisible junk characters (at least from Apache's perspective) called the Unicode BOM, or byte order mark. Apache thinks that those characters are part of the command that follows right after. This is what you see in the log, though the characters are escaped so they're visible to the naked eye. \xef\xbb\xbfRewriteEngine
In your editor, especially if your editor is Notepad, make sure you're saving your file without a BOM. This should be selectable in the save as dialog or elsewhere.
It might be the mod_rewrite module is not loaded.
Windows xampp : Open xampp/apache/conf/httpd.conf and uncomment mod_rewrite module.
Windows wamp : Open wamp/bin/apache/Apache2.x.x/conf/httpd.conf and uncomment mod_rewrite module.
Ubuntu : a2enmod rewrite && service apache2 restart
or cp /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
Then reload apache
To remove the BOM in unix use vi and below command
: set nobomb
: wq
Try this:
a2enmod rewrite
/etc/init.d/apache2 restart
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
rewriterule ^upload$ upload.php
</IfModule>
try this.
I had this problem and solved it with:
sudo a2enmod rewrite
sudo service apache2 restart
Just save your .htaccess file with UTF-8 encoding (without BOM) and upload.
Recommended to use Notepad++. (in my case that helped).
atb

Issues with mod_rewrite // Apache 2.2 // OpenSUSE 11.3

Apache Installed OK, LoadModule mod_rewrite is already uncommented in etc/apache2/httpd.conf, we've uncommented AllowOverrides and followed standard procedure for what is quite a simple install but .htaccess files are still taking no effect - are there any specific requirements for the setup above that would mean the mod_rewrite isn't working?
phpinfo() shows that mod_rewrite is loaded but we simply can't make any .htaccess file work, even with the simplest tests
RewriteEngine on
RewriteRule ^link([^/]*).html$ testrule.php?link=$1 [L]
Any ideas, anyone?
Another test to see if it's running is
lsof | grep mod_rewrite
I found after adding the 'rewrite' to the conf file and running the update
SuSEconfig
it still wasn't loading so I added it manually to this file as well
/etc/apache2/sysconfig.d/loadmodule.conf
After restarting apache all is working!
AllowOverrides could also be configured inside Directory tag, may be AllowOverrides is uncommented and On globally but is explicitly off in Directory tag.
Just a comment based on the provided information, it would be great if you could paste the related part of your httpd.conf.

Resources