I'm trying to rename my domaine via htaccess fom http://old.com/page to http://new.com/page , in the first page http://new.com/ working fine, but when I want to go to other page I have 2 problems:
the the url not changed they have always the some text , like :
http://new.com/
the rewriting of page does not working until I
add .php like this : http://new.com/page.php
this is my htaccess code :
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^old\.com [NC]
RewriteRule ^/(.*) http://new.com/$1 [R=301,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)$ http://new.com/$1 [R=301,NC]
RewriteRule ^page$ page.php [QSA,NC]
I'm really have no idea about this :(((
I may be wrong, but I think you don't need to add / in your RewriteRule ^/(.*) http://new.com/$1 [R=301,NC] line.
Try this and let me know (I havent tested it) :
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^old\.com [NC]
RewriteRule ^(.*) http://new.com/$1 [R=301,NC]
# -----------^-------- the change is here
This should redirect any page from old.com to the same page on new.com.
You can use this :
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
#redirect "olddomain.com/" to "newdomain.com/"
RewriteCond %{HTTP_HOST} ^old\.com [NC]
RewriteRule ^$ http://new.com/ [R=301,L]
#rewrite "olddomain.com/page" to "olddomain.com/.php"
RewriteRule ^page$ page.php [L,NC]
Related
I try when user register on my site its profile open in subdomain
right now profile path is
mywebsite.com/page.php?usname=username
I want to convert this in to
username.mywebsite.com
I try various method given here but none of the work for me
I added *.mywebsite.com in DNS zone a record
and use this in my .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.mywebsite.com
RewriteRule (.*) http://mywebsite.com/$1 [R=301,L]
RewriteRule ^([aA-zZ])$ page.php?usname=$1
RewriteCond %{HTTP_HOST} ^(^.*)\.mywebsite.com
RewriteRule (.*) page.php?usname=%1
this code not redirect to username.mywebsite.com
hope some give idea how to correct this .
Is this what you want?
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.mywebsite.com$
RewriteRule ^(.*)$ http://mywebsite.com/$1 [R=301,L]
RewriteCond %{QUERY_STRING} usname=([^&]+)
RewriteRule ^page.php$ http://%1.mywebsite.com/ [L,R=301]
RewriteCond %{HTTP_HOST} ^(^.*)\.mywebsite.com
RewriteRule ^(.*)$ page.php?usname=%1
I am trying to do a url rewrite for php dynamic pages. The rewrite sends them to the page but I am getting a 404 error. In my php page i use $coinshow =$_REQUEST['coinshow'];
I want to to go from sitename.com/coinShowPage.php?coinshow=XyzShow to sitename.com/XyzShow or I would be happy with sitename.com/coinshows/XyzShow too.
Please note coinShowPage.php is the only page I need redirected.
Here is the .htaccess file
RewriteEngine On<br>
RewriteCond %{THE_REQUEST} ^[A-Za-z]{3,}\s/+coinShowPage\.php\?coinshow=([^\s]+) [NC]
RewriteRule ^ http://www.SiteName.com/%1? [R=301,L]
I already tried the following and it did not work
RewriteEngine On
Options +FollowSymlinks -MultiViews -Indexes
RewriteBase /
RewriteRule ^/([0-9]+)/?$ coinShowPage.php?coinshow=$1 [NC,L]
Any help would be greatly appreciated.
Try this:
Options +FollowSymlinks -MultiViews -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Za-z]{3,}\s/+coinShowPage\.php\?coinshow=([^\s]+) [NC]
RewriteRule ^ http://www.SiteName.com/%1? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ coinShowPage.php?coinshow=$1 [QSA,L]
I have a URL like this
www.subdomain.mydomain.com/mydir/admin/index.php?page=dashboard
I want to have a user friendly url like this
www.subdomain.mydomain.com/mydir/admin/dashboard
How do I achieve this? I am trying with the below mentioned code. What am I doing wrong here?
Options -MultiViews
# URL rewriting module activation
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !^(TRACE|TRACK|GET|POST|HEAD)$
RewriteRule .* - [F]
RewriteBase /
Options +FollowSymLinks
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?page=$1 [L]
For a similar context please refer this question.
Try this .htaccess:
Options +FollowSymLinks -MultiViews
RewriteEngine on
# use appropriate rewrite base
RewriteBase /mydir/admin/
RewriteCond %{REQUEST_METHOD} !^(TRACE|TRACK|GET|POST|HEAD)$
RewriteRule ^ - [F]
RewriteCond %{THE_REQUEST} /index\.php\?page=([\w-]+) [NC]
RewriteRule ^ %1? [L,R]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ index.php?page=$1 [L,QSA]
My SSL only covers swellnomore.com, not www.swellnomore.com.
I get a security error when i type https://www.swellnomore.com. Can this be fixed (forwarded to https://swellnomore.com ?
I had tried putting the following to htacess but did not helped too
# Override GoDaddy defaults that inhibit URL rewriting
Options -MultiViews
rewriteEngine On
# Rewrite URLs to remove www from domain name
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Before putting the above , htaccess looked like this
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteEngine On
RewriteBase /
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteCond %{HTTP_HOST} ^swellnomore.com$
RewriteRule ^/?$ "https\:\/\/swellnomore\.com\/" [R=301,L]
P.S , I had already changed the site domain to
https://swellnomore.com in wp dashboard > general settings.
If you rewrite the domain , you should rewrite to https not to http
Try this rewrite rule:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
whole htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
# END WordPress
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
Yes, it is possible. You just have to put this .htaccess in your root folder :
RewriteEngine On
RewriteBase /
RewriteRule ^/?$ http://sub.domain.com/this [L]
try this javascript
<script type='text/javascript'>
if(history.replaceState) history.replaceState({}, "", "/");
</script>
Note : where / is the path u want to show.
it shows the url like mysite.com no matter which link i have clicked. but i have a problem with this code while reloading the page the complete url with query string blink into address bar.
Update
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
Example: http://www.addondomain.com/projects/a/gallery/4/2 -> http://addondomain.com/projects/a/gallery/4/2
Maybe this will help you:
Add this to your .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
I've searched on here and google and can't seem to get this right.
I have a .htaccess file in root ... I want all address to my site to go to a subdirectory (/foo.com/public_html/) and set the baseDirectory.
/.htaccess
Options +FollowSymLinks
Options -MultiViews
RewriteEngine on
RewriteBase /foo.com/public_html/
rewritecond %{http_host} ^bar.com [nc]
rewriterule ^(.*)$ http://www.bar.com/$1 [r=301,nc]
rewriterule ^$ /foo.com/public_html/ [nc]
Does this help:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursitename\.com$
RewriteRule (.*) http://www.yoursitename.com/$1 [R=301,L]
RewriteRule ^$ yoursub-directoryname[L]