URL rewrite problems - php

I am working on www.quippoauctions.com site here I am facing one problem. I have a
url: http://www.quippoauctions.com/index.php?do=auctiondetails&id=1134
i want to show this url as
http://www.quippoauctions.com/auctiondetails/1134/demo_auction_for_training_purpose.html
with the help of .htaccess file acn anyone help me on this
I have an htaccess file where I am writing
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^auctiondetails/(.*)/(.*).html$ ?do=auctiondetails&id=$1

try this
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/(.*)/demo_auction_for_training_purpose\.html$ /index.php?do=$1&id=$2
OR
RewriteRule ^auctiondetails/1134/demo_auction_for_training_purpose.html$ index.php?do=auctiondetails&id=1134 [L]

Related

htaccess rewrite rule knowledge

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]

Rewritting URL by htaccess

When i click on a link it should redirect to
for ex; www.domain.com/demo/item.php?item=abc&id=3
but in url it should show as www.domain.com/demo/abc/3
im Using
<IfModule mod_rewrite.c>
Options +SymlinksIfOwnerMatches
RewriteEngine on
RewriteRule ^demo/(.+) demo/item.php?item=$1&id=$2 [NC,L]
Please help
You can try with this one, it will not redirect your URL but if you execute your URL (www.domain.com/demo/abc/3) it will be work.
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^demo/([0-9a-zA-Z\s_]+)/([0-9]+)(/?)$ demo/item.php?item=$1&id=$2 [NC,L]
You could try like this after adding the rewritebase directive
RewriteEngine on
RewriteBase /
RewriteRule ^demo/([0-9a-zA-Z\s_]+)/([0-9]+)(/?)$ demo/item.php?item=$1&id=$2 [NC,L]

.htaccess redirecting the display images in other server

Can you help me out with my problem about .htaccess redirecting the display images in other server..
i got this in my .htaccess
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.(jpg|png|jpeg|gif)$ http://www.newurl.com/folder/folder/i/m/img_4fa231e793149_s.png
[NC,L]
this htaccess only redirects only one images which is img_4fa231e793149_s.png
i would like to do is to retrieve all the images which is here ->http://www.newurl.com/folder/folder/i/m/...
any help is appreciated thanks a lot....
Use your captured group $1:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /magento/media/catalog/product/i/m/
RewriteRule ^(img_[^.]+\.(?:jpg|png|jpeg|gif))$ http://www.tokopals.com/Dan/Magento_images/i/m/$1 [NC,L,R]

SEO friendly url in PHP htaccess

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>

Restructure urls using .htaccess file

I need to convert links such as
http://www.example.co.uk/blog/archive.php?date=2012-05
to
http://www.example.co.uk/blog/archive/2012/05/
using php or .htaccess file.
.htaccess file
RewriteEngine on
RewriteRule ^blog/archive/([0-9]+)/([0-9]+)/$ http://www.example.co.uk/blog/archive.php?date=$1-$2 [NC]
Ive have tried this but not having any luck. Any ideas or help would be appreciated.
Put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^blog/archive/([0-9]+)/([0-9]+)/?$ blog/archive.php?date=$1-$2 [NC,L,QSA]

Categories