I want to rewrite the url of mysite with help of htaccess. My website url which I need to rewrite is given below.
http://getallfreedownloads.com/category.php?slug=business_directory_listing
Result needed
http://getallfreedownloads.com/business_directory_listing or http://getallfreedownloads.com/business_directory_listing/
I have used the below code for rewrite rule in my htaccess file
RewriteEngine On
RewriteRule ^([^/]*)$ /category.php?slug=$1 [L]
Please guide me what I can do to make it work fine.
Note: After adding rewrite rule I have removed the " category.php?slug= " from the a Tag
I will be thank full to you all.
try this once.
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^/category.php?slug(.*)$ /$1 [L,NC,R]
Related
I have written rewrite rule in .htaccess file as below:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule index/cat/(.*)/ index.php?cat=$1
</IfModule>
But this rule doesn't work.
I have this url /index.php?cat=auto%20loan and I want to change to /cat/auto-loan/.
So if you have any idea then please let me know.
Use this code
RewriteRule ^cat/(.*)/?$ index.php?cat=$1 [L,NC]
I have made forward slash at the end optional. You should not make it optional to avoid duplicate content issue(SEO) such as RewriteRule ^cat/(.*)$ index.php?cat=$1 or RewriteRule ^cat/(.*)/$ index.php?cat=$1. Choose a format and stick to it.
My badluck I'm a UI developer and given the task of URL rewriting please help me.
I've this URL with me /abc/def/ghi/somefile.php?id=1
I want it to just somefile?id=1
I do have this code in my .htaccess
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^/abc/def/ghi/(.*)$ /$1 [L,NC,R]
but after uploading the htaccess to server this is giving me 404 error after removing the /abc/def/ghi/ part.
Any help is greatly appreciated.
RewriteRule not receive first slash
RewriteRule ^abc/def/ghi/(.*)$ /$1 [L,NC,R]
I want to turn a url in the url friendly.
my url:
http://www.builtbydoctors.com/qrcode/index.php?id=93
and i want this url friendly:
http://www.builtbydoctors.com/qrcode/**title**/93
the title changes depending on the id.
my problem is in the htaccess file in the creation of the regular expression. there have:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index/([a-z0-9-]+)/([0-9]+)/?$ /index.php?id=$2&nome=$1 [NC]
</IfModule>
I know that the problem is in the htaccess file, can help me solve this problem in regular expression?
Your rule will work for url
http://www.builtbydoctors.com/index/title/93
If you want use it for your example then you should change your rule to
RewriteRule ^qrcode/([a-z0-9-]+)/([0-9]+)/?$ /index.php?id=$2&nome=$1 [NC]
Try to do so
<IfModule mod_rewrite.c>
RewriteEngine On
# Using this you can tell Rewrite to have a base url
RewriteBase /qrcode
RewriteRule ^([a-z0-9-]+)/([0-9]+)/?$ index.php?id=$2&nome=$1 [NC,L,QSA]
</IfModule>
Hope that works!
I use Godaddy Apache server to build my own blog, and I did some search of SEO friendly url tutorials, and applied the following code in my web root .htaccess file to transfer links like http://www.bgmemo.com/blog.php?url=2012/08/23/4-steps-to-initialize-Apache-Derby-10-9-1-0-in-Netbeans-7-1-1.html to http://www.bgmemo.com/blog/2012/08/23/4-steps-to-initialize-Apache-Derby-10-9-1-0-in-Netbeans-7-1-1.html :
RewriteEngine on
RewriteRule ^([a-zA-Z0-9-/]+).html$ blog.php?url=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ blog.php?url=$1
But it does not work. The htaccess is working and other code in it is applied. Who can tell me what is wrong? Thanks in advance.
Try this:
RewriteEngine on
RewriteBase /
RewriteRule ^blog/([a-zA-Z0-9\-/\.]+)/?$ blog.php?url=$1 [L]
This is the correctly way for donĀ“t have problems with your .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^blog/([a-zA-Z0-9\-/\.]+)/?$ blog.php?url=$1 [L]
</IfModule>
I'm try to rewrite my url
http://www.domain.com/live/randomword
it should go rewrite to
http://www.domain.com/live/?cat=randomword
here are my tests:
RewriteRule ^live/(.*)$ /live/?cat=$1
RewriteRule ^live/(.*)$ live/?cat=$1
and all i have in the htaccess file is:
RewriteEngine on
You should try to add a RewriteBase / to your .htaccess and to suffix your rule with a [L] to say it's last rewrite rule ending with something like that:
RewriteEngine on
RewriteBase /
RewriteRule ^live/(.*)$ live/index.php?cat=$1 [L]
If this still doesn't work be sure to check that mod_rewrite is enabled
also you can do a [R,L] instead of [L] to see the redirection in the url and so have more info on what's going own.
hope this help
Have this code in your .htaccess file:
Options -MultiViews +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^live/(.*)$ /live/?cat=$1 [L,NC]
in rewrite rule the file name or extension in missing?
write rule like,
RewriteRule ^live/([a-zA-Z0-9_-]+)$ /viewcategory.php?cat=$1