Hi for some reason the htaccess file is not working properly
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?mallyear.com$
RewriteCond %{REQUEST_URI} !^/prod/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /prod/$1
RewriteCond %{HTTP_HOST} ^(www.)?mallyear.com$
RewriteRule ^(/)?$ prod/ [L]
so all the files are in this directory prod/ but when i enter this url
https://www.mallyear.com/landing
it shows "The requested URL /prod/landing was not found on this server."
why is this happening? Please help
Related
I have the following htaccess file, which is setup to redirect /page1 to index.php?route=page1 etc. But if I attempt to go to my root (www.mydomain.com) it is redirected to www.www.www.www.... I just can't work out what's gone wrong.
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(\w+)/?$ index.php?route=$1 [QSA,L]
Thank you.
I have a website installed on the following folder structure:
mywebsite.com
-/test
--/current
My goal is to have a domain
mywebsite.com/test
with RewriteCond to look into /current subfolder.
Here is what I have so far :
RewriteEngine on
Rewriterule ^$ /test [L]
RewriteCond %{HTTP_HOST} ^(www.)?mywebsite.com$
RewriteCond %{REQUEST_URI} !^/current/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /current/$1
RewriteCond %{HTTP_HOST} ^(www.)?mywebsite.com$
RewriteRule ^(/)?$ current/index.php [L]
But unfortunately this createt redirection issue
My site URL structure is showing in search results as "/www.domain.com" (with a forward slash before www)
I believe the problem is with the htaccess file. Does anyone know a fix?
htaccess code is below. Many thanks.
RewriteEngine On
RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^(.*)\.html$ %2$1.php [QSA,L,R=301]
RewriteCond %{HTTP_HOST} ^kentuckycartitleloans.com
RewriteRule (.*) http://www.kentuckycartitleloans.com%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*about.php$ %2contact.php [QSA,L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*online-application.php$ %2apply.php [QSA,L,R=301]
I have this code in my .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(online-shop)/?$ $1/home [L,NC]
RewriteRule ^(my)/?$ $1/home [L,NC]
RewriteRule ^(blog)/(post|tags)/([\w-]+)/?$ index.php?id=$1&type=$2&unique=$3 [L,QSA,NC]
RewriteRule ^(blog)/(archives)/([0-9]{4})/([0-9]{2})?$ index.php?id=$1&type=$2&year=$3&month=$4 [L,QSA,NC]
RewriteRule ^([\w/-]+)/?$ index.php?id=$1 [L,QSA]
So the following URLs are rewritten:
domain.com/home to domain.com/index.php?id=home
However if i look at a subdomain (cp.domain.com) i get the following error:
The requested URL /home/user/public_html/index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
so the subdomains are looking in the ROOT directory for the domain however they should be looking in the directory set in the control panel
As soon as i remove this line of code:
RewriteRule ^([\w/-]+)/?$ index.php?id=$1 [L,QSA]
the subdomains start working fine
You can try to restrict last rule to only work for main domain:
RewriteCond %{HTTP_HOST} ^(?:www\.)?domain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w/-]+)/?$ index.php?id=$1 [L,QSA]
I'm trying to set up a local instance of a php site working in a server, in the "/" directory. My local instance will work in my development environment in a "/subdirectory/".
I'm trying to translate .htaccess to adapt to this, but I always get a 404. This is original .htaccess:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^my-nice-url$ /index.php?p=ugly_url
And these are my tries:
RewriteEngine on
RewriteBase /mylocaldirectory/
# Not in local! RewriteCond %{HTTP_HOST} ^example.com$ [NC]
# Not in local! RewriteRule ^(.*)$ http://www.example.com/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^my-nice-url$ /index.php?p=ugly_url
Also
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)my-nice-url$ /index.php?p=ugly_url
Thank you
If i got you right, you want make a user friendly url, i do it like this:
RewriteRule ^(.*)/(your-nice-url)$ ($1)/$2/ [R=301]
RewriteRule ^(.*)/(your-nice-url)/$ $1/index.php?p=$2 [L]
or
RewriteRule ^(.*)/(your-nice-url)$ ($1)/$2/ [R=301]
RewriteRule ^(.*)/(your-nice-url)/$ $1/index.php?p=what-ever-you-need [L]
Hope it help you.