i was trying to rewrite this "about_cproject.php" in to "about" ,actually "about_cproject.php" is in inside of a derectory call "support" . When i access this page on browser it is looks like this
http://localhost/cproject/support/about_cproject.php
but i want to make it looks like this
http://localhost/cproject/support/about
any help much appreciated.
Thank you !
Try :
RewriteEngine on
RewriteRule ^about$ /cproject/support/about_cproject.php [L]
$ is important at the end of the pattern to match the complete string "about"
Related
I change my URL name using mod write. But my URL doesn't show the changes on browser.
This is how it looks from before and after
www.mydomain.com/toy/image.php
to this
www.mydomain.com/toy/xbox
How can I make this: www.mydomain.com/toy/xbox appear on the browser
Another words on my website it should appear www.mydomain.com/toy/xbox instead of this
www.mydomain.com/toy/image.php
This is my code:
RewriteEngine On
RewriteRule ^toy/xbox$ /toy/image.php* [L,R]
Can someone to explain to me how it works. Did I missed a step? Do I need to used PHP?
If I did make a mistake, correct me so I can learn from my mistakes. I try to google this but I couldn't find what I need to do
Any links or explanations would be appreciated. Thanks.
For it to "show the URL," you need it to do a 301/302 redirect, with a location header. All you have to do is end your RewriteRule line with [L,R=301]
You must perform a redirect using the R flag instead of just a rewrite.
RewriteRule ... ... [R]
I’m a noob in url rewriting and i really need help to figure this out :
I have this url : section/news.php?url=section/news/27-how_to_make_rewrite.html I want to access this news with the url parameter and the link would be : section/news/27-how_to_make_rewrite.html
the .htacess file is in the root, i have a folder named section and inside this folder i have the news folder
This doest work for me.
I have :
RewriteEngine on
RewriteBase /section/
RewriteRule news/^([a-zA-Z0-9-+/]+)/$ news/news.php?url=$1
How I can do it ?
I have not used this with subfolders, but I would try something like this.
RewriteRule ^news/([^/\.]+)/?$ news/news.php?url=section/news/$1 [L]
Edit
Try it this way:
RewriteRule ^section/news/([^/.]+)/?$ news.php?url=section/news/$1 [L]
You normally only want to put what is changing in the variable. section/news/ is always used so you should keep it outside of the replacement.
If the URI you want to rewrite to looks like: section/news.php?url=section/news/27-how_to_make_rewrite.html
then you've got one too many "news" in your target. You also need to fix your regex pattern to match stuff like 27-how_to_make_rewrite.html.
You want something like:
RewriteEngine on
RewriteBase /section/
RewriteRule news/(.+)/?$ news/news.php?url=section/news/$1
I have a serious problem which is the next :
I have a directory like this : http://example.com/kl/bold2/bold3/contents/
what I would like to do is to make is a rewrite, for example I have :
http://example.com/kl/bold2/bold3/contents/menu.php?menu=herewego
and I would like to transfer it to this :
http://example.com/herewego
So, guys how can I do this with htaccess ?
Thank you for helping !
you should put something in url that Apache can decide which rule should apply! otherwise it's impossible to rewrite URL with correct rule!
for example :http://example.com/longdir/herewego
RewriteRule ^longdir/(.*)$ kl/bold2/bold3/contents/menu.php?menu=$1
i tried to create this url rule buts not working: i dont know why :(
orginal url
www.example.com/viewprofile.php?username=jhon
the desired friendly url is
www.example.com/user/jhon
this is my.htaccess code:
RewriteEngine On
RewriteRule ^username/([^/]*)$ /viewprofile.php?username=$1 [L]
thanks for helping!! :))
I found this tutorial where the author explain step by step how to do exactly what you are trying to do. See if it helps: http://www.emanueleferonato.com/2008/06/15/how-to-generate-friendly-urls-with-htaccess-part-2/
I have set.php?mod=avatar set.php?mod=info. Now I want make it set/mod this, using this:
RewriteRule ^set/(.*)/?$ set.php?mod=$1
It's working, but when open it like set/, it's give me 404 error. How can I make it in one pharse?
Like:
RewriteRule ^set/if this exist ok if not I want it equal set.php only(.*)/?$ set.php?mod=$1
What about:
RewriteRule ^set/([^/]+)/?$ set.php?mod=$1