Ember redirect rule .htaccess - .htaccess

I'm new to ember. I have a fairly stupid question.
My site works great on locahost:4200, but I can't figure out how to have it display at my domain's url.
What I've done:
I created an .htaccess in app/public. The file contains the following:
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
I then build the app using ember build --env production. The htaccess file gets added to the app/dist directory.
I push the code. When I go to my domain, I don't see my site.
What am I doing wrong?
Thanks for your help!!

Doesn't this have to do with your hosting company and your DNS configuration in the "A" record for your service? I'm by no means an expert at this. I use Digital Ocean and have referenced their DNS guide in the past when dealing with such an issue:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean
Good luck, Jeff

Related

.htaccess for multiple APIs addresses

I have a domain that hosts 3 different Wordpress pages and two different APIs.
It works more or less like this:
http://mywebsite.com (this one has a worpress in the root folder)
http://mywebsite.com/wordpress2 (another wordpress installed in this subfolder and having another domain redirecting to it
http://mywebsite.com/wordpress3 (same as above)
http://mywebsite.com/backend/domain1/api/v1
http://mywebsite.com/backend/domain2/api/v1
Now, I would like to have Rewrite rules for the API URLs so I can have:
http://mywebsite.com/domain1/api/v1
http://mywebsite.com/domain2/api/v1
While the URLs of the Worpress websites are left unaltered.
I have tried the below, but not working:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule domain1/api/v1(.*)$ backend/domain1/index.php?request=$1 [QSA,NC,L]
RewriteRule domain2/api/v1(.*)$ backend/domain2/index.php?request=$1 [QSA,NC,L]
</IfModule>
Can anyone shed some light? Thanks
My bad, all. It was not working because the httpd.conf file had the line "LoadModule rewrite_module modules/mod_rewrite.so" commented out.

.htaccess rules for Laravel installation

I am having trouble getting my Laravel installation to work on my local server. It has been pulled from a server where it was working correctly but now none of the links work and I can't seem t get them working.
My WAMP Laravel installation is in the folder WWW (root folder of local server)...
Here is the /htaccesss (as it comes from the live server:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /~celeb/index.php [L]
Now, I know I will have to remove the '~celeb' part in the Rewrite Rule but when I do this the links still do not work. For example, when I click on a link such as "****/signup" it doesn't work, but when I add 'index.php' into it ("*****/index.php/signup') it works fine.
Does anyone know why this is happening as it is driving me crazy!
Thanks
I had the same problem and adding the RewriteBase rule to the .htaccess file did solve it.
Example for url : localhost/example/index.php :
RewriteBase /example
Then restart apache and maybe it'll work :)
Bests,
Kevin

Getting Symfony2 to Work on GoDaddy without app.php

I got my Symfony site installed on my GoDaddy production sever. It works fine when I use the url www.amcolan.info/Symphony/web/app.php/index. I want it to set it up to work as www.amcolan.info/index.
I altered the domain to point to the folder amcolan/Symfony/web via a GoDaddy control panel. It used to point to /amcolan which contains the working version of my site. After I got that set up, I installed the following .htaccess file:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# Explicitly disable rewriting for front controllers
RewriteRule ^/app_dev.php - [L]
RewriteRule ^/app.php - [L]
# Fix the bundles folder
RewriteRule ^bundles/(.*)$ bundles/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
# Change below before deploying to production
RewriteRule ^(.*)$ app.php [QSA,L]
#RewriteRule ^(.*)$ app_dev.php [QSA,L]
</IfModule>
I got the code from another related question on this site and modified to my purpose. The original was intended to live in the Symfony directory. I then cleared the production cache and attempted to access a page. It resulted in an Internal server error. Are there any errors in my code? You'd think this would be well documented by Sensio as I imagine 99% of all implementations would have to do this. Now I'm just getting bitter.
As suggested, I tried the following code that came with Symfony:
<IfModule mod_rewrite.c>
RewriteEngine On
<IfModule mod_vhost_alias.c>
RewriteBase /
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
I also tried:
<IfModule mod_rewrite.c>
RewriteEngine On
#<IfModule mod_vhost_alias.c>
#RewriteBase /
#</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
I got the same error as before with both. To make sure I was getting to the directory, I added a index.php file to it and I was able to access it.
Update 2
After rooting around some more about goDaddy specific issues, I found a post on a goDaddy forum saying the RewriteEngine is already on. I deleted that code without affect. I then decided to try this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://www.amcolan.info/app.php/index [QSA,L]
That got it to work although I suspect not correctly. I had first tried it without the index after app.php/. That got me into symfony, but generated a get error. It appeared to be because of a null argument so I added the index. So, regardless of what someone might enter after www.amcolan.info, it's going to go to the index. Once you are on a Symfony page, you can navigate to other pages in the site. So now I have three new questions:
Any idea to where the web server is pointing when it reads the .htaccess file? You would think in the /web directory as that's where the file lives. Since just specifying app.php instead of the full path didn't work, it must not be the case. Would it be the base of my site?
After the successful redirection of www.amcolan.info, the resulting displayed URL is www.amcolan.info/app.php/index. I'd like to not see the /app.php in the URL, but I suspect that's not possible in as much as it is the actual destination. Is that a correct assumption?
How do I get www.amcolan.info/somepage to go to www.amcolan.info/app.php/somepage rather than the hard coded index?
Update 3
I thought I was stuck, but then I tried:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php/index [QSA,L]
That got rid of having to use the full URL and now the destination pages no longer display the app.php. I have a new problem: just specifying www.amcolan.info causes the get error mentioned above. Specifying www.amcolan.info/somepage no longer takes me to the index, but to the specified page. Stay tuned, I may be able to solve my last problem with a little more digging.
Update 4
I fixed the last problem by adding the following to my routing file:
nopage:
pattern: /
defaults: { _controller: ZetchoAmColAnBundle:Default:index }
requirements:
_method: GET
I think I'm a happy camper now.
index action is not necessary. You can easily configure any action for root routing as well.
Here is my full .htaccess file on GoDaddy that finally works. It works only for prod config (app.php), app_dev.php is not working well, but that is OK for me since it is used for production environment.
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /app.php/ [QSA,L]
</IfModule>

codeigniter block me from accesing my phpmyadmin installation on subdirectory

I have my own CMS built using CodeIgniter (actually, it's not me who developed it. My client gave it to me from their previous developer). No, I'm in the process of migrating the CMS to a new server. I set it up and everything works fine. Except, I can't access my phpmyadmin installation which reside on the subdirectory of my public_html (which contain the CodeIgniter CMS).
www.mysite.com <-- this to access my CodeIgniterCMS based website
www.mysite.com/phpmyadmin <-- this to access my phpmyadmin
installation, which currently inaccessible and just showing CI's
default 404 error page
This might have something to do with CodeIgniter routing configuration or htaccess file and stuff like that. But I'm a total newbie on both CodeIgniter and htaccess.
What should I do to make me able to access my phpmyadmin?
this is my codeigniter htaccess file
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
let me know what other information (chunk of code, config files etc) should I show here to give better detail of my environment
Your htaccess is not poking a hole through to let access to phpmyadmin.
try
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(phpmyadmin|index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

How to run concrete5 in a subdirectory?

I've put my concrete5 installation in the subfolder /www/concrete5. I've tried different entries in my .htaccess file but all modes seem to have some errors.
There is mainly one forum post about it
Domain root - CMS link problem
but it does not seem to work in edit mode. However, this forum post is quite old.
Is there a simple way of accessing a concrete5 installation in a subdirectory as if it were in the root?
Here is a detailed description on how to do this:
http://www.concrete5.org/documentation/how-tos/developers/hide-the-subdirectory-url/
What does your site.php file look like?
I run a lot of cms sites from subdirectories and my htaccess file is pretty standard:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I do the directory specific settings in the site.php file in the config directory.
define('BASE_URL', 'http://domain.com');
define('DIR_REL', '/dirname');

Resources