I want to change a url like:
dynamicdomain.com/mypage
to
dynamicdomain.com/mydashboard
I want to display the content of mypage but the url that the users will see on the browser will contain mydashboard. How do I do this using .htaccess.
I tried using this:
RewriteEngine On
Redirect 301 /mydashboard /mypage
but this redirects the url:
dynamicdomain.com/mydashboard
to
dynamicdomain.com/mypage
Edit:
Here is another example on what I want to achieve:
I have a folder mypage which can be accessed as:
http://dynamicdomain.com/mypage/
I want the users to see http://dynamicdomain.com/mydashboard/
(mydashboard folder doesn't exists) when they access http://dynamicdomain.com/mypage/
can someone point me in the right direction.
Thanks.
Try these directives:
RewriteEngine On
RewriteRule ^mypage$ /dashbord [NC,L]
Redirect directive does an external redirect (redirects a URL to another URL). To redirect "dashboard" internally to "/mypage", you need to use the RewriteRule directive of the Rewrite module.
Put this in your htaccess file :
just after IfModule closes
Redirect 301 /mypage http://www.dynamicdomain.com/mydashboard
This will work for you.
thanks
Related
I want to redirect
/public/courses/((anything)) to /courses
this is my code , it does not working
Redirect 301 /public/courses/.* /courses
How can I explain any link to .haccess file?
Please try following htaccess Rule. Make sure to place this rule top of your htaccess Rules file.
Please clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteRule ^public/courses/.*$ /courses [R=301,L]
hello I have an indexed page, whose url: website.ext/recensione/43-Dungeons--Dragons-Neverwinter-PS4
Unfortunately I had to change the structure in the url: website.ext/recensione/43-dungeons--dragons-neverwinter-neverwinter---un-dd-allennesima-potenza
There is no way to make the redirect via .htaccess?
Add this rule to your htaccess file and it will work.
RewriteRule ^recensione/43-Dungeons--Dragons-Neverwinter-PS4$ /recensione/recensione/43-dungeons--dragons-neverwinter-neverwinter---un-dd-allennesima-potenza? [L,R=301]
I've looked all over for the htaccess code to redirect a single page and haven't had any luck with many solutions.
Basically I need to redirect this:
/example/my-stuff/
to:
/example/home/
but I don't want any other pages except for /my-stuff/ to be redirected. Eg. these pages should not be redirected and kept the same.
/example/my-stuff/a-page
/example/my-stuff/anything
In the htaccess file in your document root, you can add either this:
RedirectMatch 301 ^/example/my-stuff/$ /example/home/
Or you can use mod_rewrite instead:
RewriteEngine On
RewriteRule ^example/my-stuff/$ /example/home/ [L,R=301]
I'm trying to redirect a few pages to a new domain and I have done this before but for some reason I can't get the code to work.
RewriteEngine On
Redirect 301 http://domain.com/page1.html http://domain2.com/page1.html
Can anyone see where I'm going wrong?
In .htaccess file the below code will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Since you say you only want to direct a FEW of your pages and not all of them, you can do:
RewriteEngine On
Redirect /~myaccount/oldpage.html http://www.newsite.com/newpage.html
You specify the path to the page on your current server followed by the URL to redirect to.
OR you can do:
RedirectMatch 301 ^/oldpage\.html$ http://www.newsite.com/newpage.html
I am using PHP and I need to use a name say "Pranav dave" in url which should redirect me to "myprofile.php" what should i do?.. also the url should display me "Pranav dave".. and what should be the htaccess rule to redirect any html file to php file?
You could make it like this:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)$ myprofile.php?profile=$1 [NC]
After that, you can use your urls like this http://example.com/Pranav dave. The only problem is, that the browser will rewrite the url, and after that, its looking like followink one http://example.com/Pranav%20dave