473,854 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.htaccess file is not working

160 New Member
Hi to all
I m looking for some help. i want to do url rewritting. i write code e.g
Expand|Select|Wrap|Line Numbers
  1. Options +FollowSymLinks
  2. RewriteEngine on
  3. RewriteRule index/show/(.*)/cat/(.*)/ index.php?show=$1&cat=$2
  4. RewriteRule index/show/(.*)/cat/(.*) index.php?show=$1&cat=$2
  5.  
1)On local host its give an error "Internal Server Error". same error occurred even when i wrote just first two lines of above code.

2)On live site it not give any error but its not working at all. In fact there is no effect of writing above code.

is there any problem in php settings. Please send me some solution. I tried hard but did't find any solution
Feb 6 '10
12 4364
Atli
5,058 Recognized Expert Expert
Your welcome. Glad I could help :)

One last thing I should point out though.

Your RewriteRule. It is meant to allow you to use this URL:
- index/show/zzz/cat/yyy/
instead of this URL:
- index.php?show= zzz1&cat=yyy

I should point out that search engines would most likely have an easier time understanding the original one, with the query-string. There, they can match up the values with their respective keys, whereas in your new version they can't.

In fact, you may well be better of leaving it unaltered.
If not, I still suggest you change the structure of the new URL. If you explain what the values - show and cat - mean and I can make a suggestion.

See these fore more details:And you can probably find a lot more of those via Google.
Feb 7 '10 #11
waqasahmed996
160 New Member
excellent point
i am doing this to make site SEO friendly
and i also read and heard from many people to use urls like
index/show/zzz/cat/yyy/
to make them SEO friendly
Atli what about if we use urls like
index-show-zzz1-cat-yyy.htm
by using url rewriting instead index/show/zzz/cat/yyy/
will it be helpful to make site SEO friendly??
Feb 7 '10 #12
Atli
5,058 Recognized Expert Expert
No, not really. Leaving it like "index.php?show =zzz&cat=yyy" would most likely be more SEO friendly. - It is easier for a computer to understand that zzz is the value of show, and that yyy is the value of cat when you use this basic format. - When you set them up side-by-side in a directory hierarchy - or even worse; as a single file name -, that becomes harder to determine. The key and the value become as two separate, equal-value values, when in fact they should be a key-value pair.

It is best to just set the URL up in a way that would be most easily understood by a human. In your case, assuming show represents an action (e.g. "list" or "details") that is to be taken on a given category, something like this may be a good idea:
  • example.com/categories/zzz.php?category=yyy
That might turn into something like:
  • example.com/categories/list.php?catego ry=name-of-category
  • example.com/categories/details.php?cat egory=name-of-category
  • example.com/categories/details.php?cat egory-id=1234
There, from the point of view of an outsider, each of your show parameters is a different PHP file, inside a "categories " directory, which takes a cat (or category) as a parameter. Pretty easy to understand both by a human visitor and by a bot.

P.S.
You should note that most of the SEO tricks that you see floating around are mostly bogus, or at least have very limited effectiveness.
A few common SEO tricks that people waste way to much time on:
  • Pretty-URLs. (mod_rewrite)
    In some cases this may have it's uses, but for the most part, use this to improve things for your human visitors, not the bots.
  • Meta description/keywords.
    This was exploited so much in the past that it is hardly worth using today. You should of course include the description (Google might display it with the link in the search results), and adding a few keywords is fine, but don't think either will improve your SEO rating.
  • Keyword spamming.
    This was also exploited. People crammed keywords all over the page to score high for them in the search results. - Today Google is more likely to penalize you for this. - You should of course include your keywords in your text, but write it for a human not for a bot.
  • Bold/strong text
    Again, exploited in the past. Bold words are traditionally more important than others, and as such, weigh more on the search results. But overusing it will just hurt you. - Use it as it was intended: to emphasize words to human readers, not to bots.
  • Link-exchange
    This *can* be helpful if used responsibly, but people are rarely responsible. - It is far more effective to write good content and "naturally" link to other pages with good content. They, in turn, may become aware of your site and link back to your content.
  • ... spamming
    An obvious way to get black-listed; banned from even appearing in search results at all. - We sometimes see it on forums like these. People signing up solely to post links to their new site, promoting their new business site. - We promptly delete stuff like that and submit it to be black-listed. - Most forum systems do.
Don't get me wrong, some of these may have limited usefulness, but compared to good content, this is close to irrelevant. - The best way to get your site noticed is to have good content; content that people will want to read and link to. A single link to your content is worth more than all of these SEO tricks combined. - Spend more time creating good content; less time on SEO. Focus on your human visitors, not the bots.
Feb 8 '10 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7700
by: yawnmoth | last post by:
i'm trying to write a php script that will password protect some random directory by creating a .htaccess file, and a password file to accompany the .htaccess file, and it isn't working... specifically, i can't enter the newly created directory with a username of test, and a password of test, which is what i am trying to do. also, i'm testing this script out on a remote server, and... after this script runs, i can't delete any of the...
4
2995
by: Ivo | last post by:
Greetings newsgroup, I am moving some php scripts to a new host. While getting to know the server, I ran into a strange problem. If I add a .htaccess file, or more specifically: a .htaccess with content, to a folder, requesting (html and php) files from that folder results in internal server error messages. If I upload an empty .htaccess file, all is fine. Then phpinfo() tells me I am using Apache/1.3.27.
7
3690
by: Nel | last post by:
Just looking for some general advice on modifying the URL for php. I am using .htaccess to allow a web site to translate example.html to index.php?content=example (below) ErrorDocument 404 http://www.example.com RewriteEngine on RewriteRule ^/?(.*).html$ /index.php?content=$1
7
7550
by: John | last post by:
Hello. I want to get this blasted .htaccess file sorted out, so I can have sessions without register_globals being on. I have looked everywhere for info on this and I mean everywhere including the php.net manual. In the manual it said to include something like the following:
0
2006
by: Jack Hambabo | last post by:
Hi, I'm searching for a php script that can find out whether the current user (I know _SERVER will give me the name for non-cgi php) has the right to view a specific file. My dream is that I just need a short php script that just asks the webserver what the rights are. That seems a reasonable wish to me. If this is however not possible than I'd like a script that can
0
11294
by: asherwolf | last post by:
Hi, I'm trying to do something I think is pretty neat, but I've just about pulled my hair out by the behavior of my server. I'm hosting on GoDaddy, using a subdomain (www.mywebpage.com maps to /mywebpage), running Apache 1.3.33, and PHP 4.3.11. The goal is to use PHP to install an .htaccess file in a folder to forbid PHP files from being accessed from outside the server. I have a working .htaccess file in one folder, and I have been...
8
1694
by: Thiago Macedo | last post by:
Hi folks, I have the Apacha server (2.2.8) with PHP installed as CGI Binary. This, as i'm discovering, means that I can't change php configurations through .htaccess. Is my searches right or there is a way of change a PHP - CGI Bynary - setting using .htaccess? Thanks,
4
6704
by: adnanjunk | last post by:
Hi, Having a little issue with .htaccess not working on windows server. I have clean url's setup using the htaccess file, working fine on linux server. I have researched for a while and found .htaccess doesn't work on windows. Since this is a shared hosting i don't have access to httpd.conf so that i can edit it. I have been reading this forum about it. http://forum.mambo-foundation.org/showthread.php?t=1857
0
2095
by: AndyPSV | last post by:
Hello, I've got .htaccess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php It works properly on mine and others servers, but not @ DOMAIN REMOVED (company, which I get free account and register domain 4 free). I writed to them and get reply:
2
2668
Markus
by: Markus | last post by:
Why is it not working? I joke. Here's the info: In the folder C:\host\www\test, I have an .htaccess file. Inside that .htaccess file is the following: RewriteEngine On RewriteRule ^test1.php$ /test2.php
0
9752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10685
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9518
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5750
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4563
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4162
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.