Removing index.php from codeigniter .htaccess on DigitalOcean - .htaccess

Removing index.php from CodeIgniter .htaccess is not working on DigitalOcean. It's working fine on localhost though.

Please refer to the Digitalocean documentation, and look in the same page for the topic How to Activate an .htaccess file. That should makes your .htaccess setting working.

Related

Can't get to work a simple 301 Redirect in Htaccess

Normally this should be easy but it doesn't seems to work.
I'm migrating an old website to a wordpress and so I need to do all the redirections in the htaccess file.
What I'm trying to achieve :
/XXX (and anything after it) redirects to /YYY/XXX
My code :
RewriteRule ^XXX(.*)$ /YYY/XXXX [L,R=301]
Thanks for your help.

.htaccess rewrite rules do not work locally with XAMPP

I have been able to successfully create rewrite rules in .htaccess to rationalize the URL's of my website (thanks to SuperDuperApps as well):
RewriteEngine On
RewriteRule ^travel/([^/]*)$ ?item=travel&blog=$1 [L]
RewriteRule ^work/([^/]*)$ /?item=work&tile=$1 [L]
RewriteRule ^(about|travel|work)$ /?item=$1 [L]
This works perfect when I access the website online via the server. However, when running it locally via XAMPP I am continuously routed back to "localhost/dashboard/" (instead of "localhost/example/travel" --> "localhost/example/?item=travel" for example).
I have set AllowOverride to All and tried to include RewriteBase, but I am not getting it to work.
Does anybody know how to successfully configure/setup XAMPP or enhance the rewrite rules in such a way that it does work locally with XAMPP as well?

Symfony .htaccess

I configured a test folder for websites in hostgator, so far I have no problems in some flatform like wordpress,magento,joomla, I did not even change any seetings in .htaccess to make it run. Recently, I am working on a symfony2 project and upload my test application in the test folder I created. This is how I create a test folder
mywebsite.com/tests/wordpress_site(no problem)
mywebsite.com/tests/joomla_site(no problem)
mywebsite.com/tests/symfony2_site(403 forbidden error)
In my WAMP, I can accessed my symfony project
localhost/symfony_site/web/
I did not touch the .htaccess since this is just a test site in local machine.
How would you configure a symfony2 project in this setup?
mywebsite.com/tests/symfony_site
It is almost impossible to create clean Urls when installing symfony in subfolder...
With Apache, the better solution is to use a VirtualHost which have tests/symfony_site/web as DocumentRoot, and to use the built-in .htaccess file (which uses url rewriting module, or if it not available, uses a 302 redirection to app.php/)
But If you can't add a virtualHost to your server, it is hard...
An other way is to add a .htaccess at tests/symfony_site and put DirectoryIndex: web/app.php
(https://httpd.apache.org/docs/current/mod/mod_dir.html)
So you can have clean URLs... but be careful with this solution: the urls parsed by the router are relative to your site root (and not to symfony root...) so the router might be lost... (e.g if you have a root named /test you should rename it /tests/symfony_site/test... And it is the same for assets, you have to add the site directory, otherwise they will return a 404 error...
In my case, I just use existing .htaccess in web folder (or I create a new one with a DirectoryIndex Instead), so my app work with URLs like mywebsite.com/tests/symfony_site/web/
I hope this helped,
Vincent
You can try typing the following code into the .htaccess file to the symfony root folder
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(img|files|images|favicon.ico|css|js|robots\.txt)
RewriteRule ^(.*)$ web/$1 [L]
RewriteCond %{HTTP_HOST} host.com
RewriteCond %{REQUEST_URI} !web/
RewriteRule ^(.*)$ web/$1 [L]

SEO Urls with htaccess and SSL

I have an issue where the following rule works without SSL however when i change to https the rule doesn't work at all
RewriteEngine On
RewriteRule ^signins/?$ /login.php
Its driving me crazy please help :(
Look into your <VirtualHost> config for your https site it might be using a different DOCUMENT_ROOT.

htaccess redirection rule

I want to redirect
http://subdom.domain.com/guidelines/article1
http://subdom.domain.com/guidelines/article2
http://subdom.domain.com/guidelines/article3
to
http://subdom.domain.com/notsoguideline/noarticlepage/blahblah
so I wrote the following rule in .htaccess of my wordpress site but it doesn't seem to work
RewriteRule ^guidelines/([^/]+)/ /notsoguideline/noarticlepage/blahblah/
Check that your hosting supports and allows the use of .htaccess files.
Ensure that you have RewriteEngine On in your .htaccess (before your custom rules)
If you create a nonsense .htaccess file what happens? If nothing then your .htaccess file is not in use.

Resources