I have a website which is working until i have uploaded .htaccess file.
My directory path be like
/MY_PROJECT
And in .htaccess Starting code is
IndexIgnore *
RewriteEngine On
RewriteBase /
i also tried by putting
RewriteBase /MY_PROJECT
but still it shows an Internal Server Error
Related
I just transferred my website from example.com/newsite to example.com by moving the folder where everything was stored (newsite) into my public_html to make it the root domain. Now I am receiving multiple issues on my error_log and the website is loading very very slowly. The error log is telling me things like:
PHP Warning: current() expects parameter 1 to be array, boolean given in /home3/example/public_html/newsite/wp-content/plugins/lezada-addons/includes/templates/lezada_brands_grid.php on line 79
I was thinking the urls containing example.com/newsite should be rewritten via .htaccess
Will this resolve the problem? If so what would the rewrite code be? I tried:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.com\newsite$ [NC]
RewriteRule ^(.*)$ "http://example.com/$1" [R=301,L]
</IfModule>
But this isn't working and the website is down!
I have a weird situation with Symfony 3.2.6. The whole code is above public_html directory which is a DocumentRoot.
In public_html I have a directory called panel. In this directory I have put app.php and app_dev.php controllers with .htaccess. I have setup properly require and include_once paths.
The problem is that when I run mydomain.com/panel/app_dev.php I get an error:
No route found for "GET /panel/app_dev.php"
So it seams that this code in .htaccess doesn't work properly for this situation.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
So I have commented out this and used this after RewriteEngine On
RewriteBase /panel/
but this gives the same result. Anyone knows how to fix it?
I am trying to figure out how to get my .htaccess to redirect just the homepage URL to a sub directory (domain.com > domain.com/sub/sub ), but I still want the URL to display as domain.com.
I looked around for the past hour and have tried a number of suggestions that I found but nothing worked out.
Any Ideas?
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^$ /sub/sub [L]
I want to access my symfony app in production env (http://www.sample.com/amateur1/web/app.php) from this url http://www.sample.com/amateur1.
To do that I moved the .htacces file to http://www.sample.com/amateur1/.htaccess with this contents:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
But when I go to http://www.sample.com/amateur1 shows a 404 Error, and prod.log isn't written.
I also used RewriteBase /amateur1/web/ because I don't know If RewriteBase path is relative to the DocumentRoot of the server, Or from the path where the .htaccess file is located. Also tried /amateur1 and /amateur1/ as RewriteBase due to this answer Symfony2: How to deploy in subdirectory (Apache)
With the three try's, The Exceptions page appears unstyled, and not loading any image. But then I get the following error in prod.log file:
[2013-02-15 02:06:47] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /amateur1/" (uncaught exception) at /home/u105859802/public_html/amateur1/app/cache/prod/classes.php line 5121 [] []
What I'm doing wrong ?
In your configuration, apache uses public_html as the document root
If Symfony2 is installed in directory /home/u105859802/public_html/amateur1, the Symfony public directory to serve is /home/u105859802/public_html/amateur1/web/
You should use
RewriteBase /amateur1/web/
But beware, it is not safe
You have to protect your symfony directories! (configuration is accessible)
Why don't you try moving your symfony files in your private area ?
You can rename the Symfony web directory to public_html
See how to do that in documentation cookbook
So, my recommendation structure looks like below :
/home/u105859802/
vendor
src
app
bin
public_html (web by default in symfony2) <- the only public directory
In most of the shared hosting, you can't override Apache settings in that case may need to wright a redirection rule in .htaccess file
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$ [NC]
RewriteRule !^projectName/ /projectName/web/app.php/%{REQUEST_URI} [L,NC]
this is the rule I used in my project .
You may need to provide full paths to your assets other ways they will not get loaded .
I have this code in my .htaccess file:
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine On
RewriteRule ^(design|JS|css|images|remoteLibraries|remoteLibraries/xAJAX/xajax_js/)($|/) - [L]
RewriteRule ^([a-zA-Z_]+)$ index.php?action=$1
RewriteRule ^([a-zA-Z_]+)/([a-z_A-Z]+)$ index.php?action=$1&tip=$2
It works fine on my local Apache server, but when uploading it to GoDaddy all I get is 404 Not found error ...
Any idea?
1) I recommend that you set a RewriteBase, usually just
RewriteBase /
which helps standardize where the rewrite takes effect, since the directory structure may be different between the local and remote servers.
2) I also recommend that whenever unexpected rewrite behavior crops up it is important to set
ErrorDocument 404 default
so that the Go Daddy 404 page is not redirected as well.