The below rewrite rule is not working in localhost.
RewriteEngine on
Options -MultiViews
RewriteBase http://localhost/project/
RewriteRule ^templates/assets/js/custom.js$ admin/templates/assets/js/custom.js.php [L]
Related
My .htaccess on localhost XAMPP works fine;
RewriteEngine on
RewriteBase /
Options +FollowSymLinks
Options -MultiViews
Options -Indexes
DirectorySlash Off
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* ? [F,L]
RewriteCond %{DOCUMENT_ROOT}/templates/$1\.tpl -f
RewriteRule ^([\w\-.\s]+)$ index.php?page=$1 [QSA,NC,L]
ErrorDocument 404 /sources/404.php
When I move it to GoDaddy host, when I'm trying to go site.com/Downloads I'm getting error 404 which doesn't happen on XAMPP.
What did I do wrong?
I need to redirect 1 single page with .htaccess but i can't figure it out
examp.co/?language=en
should redirect to
examp.co/bla/
the index.php is hidden here because it has already been redirect to root /.
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 /
RewriteCond %{QUERY_STRING} ^language=en(&|$) [NC]
RewriteRule ^$ /bla/? [L,R=301]
if user hit my_website.com then he should redirect to my_website.com/abc but if he hits my_website.com/xyz then he can visit normally.
How can i do this using .htacess file
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 /
RewriteCond %{HTTP_HOST} ^my_website\.com$ [NC]
Rewriterule ^$ /abc [L,R=302]
Once you verify it is working fine, replace R=302 to R=301. Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.
Try with this
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ http://my_website.com/abc [L,R=301]
I want to achieve the following:
http:// domain.com -> http://www.domain.com
http://sub.domain.com -> http:// sub.domain.com(and not http:// www.sub.domain.com)
I have been searching a lot today but can't find a solution. Hope someone helps here.
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 /
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
I have content from a different server on a subdomain that I would like to use as a subdirectory. Everything from sub.domain.com should be accessible to domain.com/sub I would like sub folders to work as well ex: sub.domain.com/about should be domain.com/sub/about
Here's my current .htaccess contents
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(sorry).* - [NC,L]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Any help appreciated. Thanks!
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 /
RewriteCond %{HTTP_HOST} ^sub\.domain\.com$ [NC]
RewriteRule ^ http://domain.com/sub%{REQUEST_URI} [R=301,L,NE]