|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Search Engine Optimization Forum SEO is much easier with help from peers and experts! The WebProWorld SEO forum is for the discussion and exploration of various search engine optimization topics. Any non (engine) specific SEO or SEM topics should go here. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Making urls search-engine-friendly I put the following entry in .htacess:
RewriteEngine On RewriteRule ^/services/$1 /services.php?id=$1 I thought it would show me 'services.php?id=3' if I entered 'services/3' for example. Instead it says 'Page cannot be found'. The host confirmed there are no restriction with regard to rewrite engines, so I really do not understand what is going wrong. The entry is simillar to the ones I found as examples online. I would appreciate any help with this... Son |
|
|||
|
Quote:
RewriteRule ^/services/[a-zA-Z0-9]$ /service if you want to add other characters like a dash... RewriteRule ^/services/[a-zA-Z0-9.-]$ /service |
|
|||
|
I tried it and it still does not do it. My entry is now:
Options +FollowSymLinks RewriteEngine On RewriteRule ^/services/[a-zA-Z0-9.-]$ /services.php?id=$1 [L] The id is actually a word or a combination of two words combined with a minus sign (if that is where my problem lies)... I do not get why this is going nowhere. Always page not found... Any ideas? Son |
|
||||
|
Try:
RewriteRule ^/services/([a-zA-Z0-9\-]*)$ /services.php?id=$1 [L] The dash is a reserved character and usually needs to be escaped with a backslash. You also still need to have the parentheses. That is how mod_rewrite knows which part of the original string to use to replace the $1. Also, you need to tell mod_rewrite how many characters to match. The brackets will only match a single character that matches the range of possible characters listed. Adding the asterisk after the closing bracket tells it to match as many characters as there are.
__________________
The best way to learn anything, is to question everything. Last edited by wige; 11-26-2008 at 06:39 PM. |
|
|||
|
Checked already with Host, but they say there is no restriction on mod_rewrite and they cannot provide assistance with programming etc.
I really do not get this, the real URL could be: http://www.domain.com/services.php?id=consultancy so the given entry as: RewriteRule ^/services/[a-zA-Z0-9.-]$ /services.php?id=$1 [L] should really take care of it. It does not. I also tried on different server (with different host) and on local machine. Not any better... Why could that be? Son |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Which URL is Search Engine Friendly? | Ozzman | Search Engine Optimization Forum | 2 | 02-08-2008 11:01 AM |
| Non Search Engine Friendly | sunbedkid | Link Exchange | 2 | 05-26-2005 10:31 PM |
| Search Engine friendly CMS | grasko | Web Programming Discussion Forum | 29 | 10-20-2004 08:56 PM |
| Search Engine Friendly(SEF) URLs | mySunSite | Search Engine Optimization Forum | 2 | 10-07-2004 09:23 AM |
| Multiple Search Engine URLs on Home Page | mgtman | Search Engine Optimization Forum | 1 | 08-12-2004 06:39 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |