The below Rewrite Rules are not working
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^about/?$ /about.php [NC,L,QSA]
RewriteRule ^contact/?$ /contact.php [NC,L,QSA]
ErrorDocument 404 /404.php
But if I do this it works
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^about-us/?$ /about.php [NC,L,QSA]
RewriteRule ^contact-us/?$ /contact.php [NC,L,QSA]
ErrorDocument 404 /404.php
Any help greatly appreciated
Thank
Related
My root domain htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
ErrorDocument 404 /404.php
RewriteCond %{`HTTP_HOST`} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ `https://%1/$1` [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) `https://%{HTTP_HOST}%{REQUEST_URI}` [R=301,L]
In my subfolder htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} `^(www\.example\.com)?$`
RewriteRule ^(.*)$ `https://example.com/subfolder/$1` [R=301,L]
Wehn I type in example.com/any-wrong-url, it will redirect to 404 page, that is correct.
But when I type in example.com/subfoler/any-wrong-url it can not redirect to 404 page. Where do I something wrong?
The best way to do this without creating any conflict or redirect is:
Use /subfolder/ instead of root / on the RewriteBase like this:
RewriteBase /subfolder/
Copy the 404.php inside the subfolder.
The complete code will look like:
RewriteEngine On
RewriteBase /subfolder/
ErrorDocument 404 /404.php
RewriteCond %{HTTP_HOST} `^(www\.example\.com)?$`
RewriteRule ^(.*)$ `https://example.com/subfolder/$1` [R=301,L]
This should work.
Hi Am having this little problem with .HTACCESS HTTPS redirection
Not Found
The requested URL /limoamerican/limoamerican/limofleet.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.
Any help is appreciated
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Options -Multiviews
Options +FollowSymLinks
#LoadModule rewrite_module modules/mod_rewrite.so
#AddModule mod_rewrite.c
RewriteBase /
#RewriteRule ^geo/United-States/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ ijt.php?state=$1&city=$2 [NC,L]
#RewriteRule ^geo/United-States/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ rxm.php?state=$1&city=$2 [NC,L]
RewriteRule ^geo/United-States/NY/([A-Za-z0-9-]+)/?$ mxt.php?city=$1 [NC,L]
RewriteRule ^geo/United-States/CT/([A-Za-z0-9-]+)/?$ ijt.php?city=$1 [NC,L]
RewriteRule ^geo/United-States/NJ/([A-Za-z0-9-]+)/?$ rxm.php?city=$1 [NC,L]
From This:
crunchpaper.com/jlpt/form/try_question.php
To This:
crunchpaper.com/jlpt/try_question/
I try this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^try_question$ /try_question.php/$1 [NC,QSA]
But it's not working.
I want to clean the URL above.
Please help me. Thanks
This rule should work :
RewriteRule ^jlpt/form/try_question\.php$ jlpt/try_question/ [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^jlpt/form/try_question\.php$ jlpt/try_question/ [L]
on /var/www/crunchpaper/jlpt
<Files ~ "^\.ht">
deny from all
</Files>
Options -Indexes
# ErrorPage
ErrorDocument 400 crunchpaper.com/
ErrorDocument 403 https://crunchpaper.com/
ErrorDocument 404 https://crunchpaper.com/
ErrorDocument 405 https://crunchpaper.com/
# DefaultPage
DirectoryIndex index.php index.html
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^crunchpaper.com\.com$
RewriteRule ^(.*)$ https://crunchpaper.com/$1 [R=301,L]
on /var/www/crunchpaper
Can you tell me what is wrong
I've the links as follow:
localhost/a/site/watch/contact/
localhost/a/site/details/about/
where .htaccess file is in site folder
All I want to do is remove watch and details from the url like:
localhost/a/site/contact/
localhost/a/site/about/
Update
#Options -Indexes
#Options +FollowSymLinks
RewriteEngine On
#Exclude myadmin directory from the second level links
RewriteRule ^(myadmin)(/.*)?$ - [L]
RewriteRule ^(source)(/.*)?$ - [L]
ErrorDocument 404 /404.html
RewriteRule ^([a-zA-Z0-9_\-]+)/?$ index.php?task=$1 [L]
#Redirect 2nd level links to index.php
RewriteRule ^([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)?$ index.php?task=$1&slug=$2 [L]
#Redirect 3rd level links to index.php
RewriteRule ^([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)?$ index.php?task=$1&slug=$2&page=$3 [L]
#Redirect 4th level links to index.php
RewriteRule ^([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)?$ index.php?task=$1&slug=$2&title=$3&page=$4 [L]
I've tried following but this doesnot work
#RewriteRule ^/(.*)$ /watch/$1
RewriteBase /a/site
RewriteCond %{HTTP_HOST} ^/watch/
RewriteRule /(.*) /watch/$1 [QSA,L]
RewriteRule /(.*) /details/$1 [QSA,L]
RewriteRule /(.+) /watch/$1/index.php [NC,L]
RewriteCond %{THE_REQUEST} \ /+watch/
RewriteRule ^watch/(.*)$ /$1 [L,R=301]
Insert these 2 rules just below RewriteEngine On line in /a/site/.htaccess:
RewriteRule ^(contact)/?$ index.php?task=watch&slug=$1 [L,QSA,NC]
RewriteRule ^(about)/?$ index.php?task=details&slug=$1 [L,QSA,NC]
This is my htacces file content. Its not working. Please help me guys...
DirectoryIndex index.php
Options -Indexes
RewriteEngine on
RewriteBase /shop/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
RewriteRule ^jeans-shirt/?$ /index.php?index/indexproducts/jeans-shirt/c695b64e4b38d8004f7c9b970ecbd104 [QSA,NC,L]
ErrorDocument 404 404.html
try this:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>