|
#21
|
|||
|
|||
|
Hi Mike, I actually got to chat with my host and he got it all fixed up for me.
He commented out the ones that werent working so we could see the differance. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /order/ #RewriteCond %{REQUEST_URI} ^/order.* #RewriteRule ^order/([^/]+)/?$ index.php?order=$1 [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^order/([A-Za-z0-9]*)$ /order/index.php?order=$1 [QSA] </IfModule> Its all working smoothly now. Thanx again for your help, and hopefully this will help someone else in the future. faz |
|
#22
|
|||
|
|||
|
Instead of this rule
RewriteRule ^order/([A-Za-z0-9]*)$ /order/index.php?order=$1 [QSA] I would suggest using this one it will be a faster and less strain on the server. it will also pick up the url with or with out the trailing / RewriteRule ^order/([^/]+)/?$ /order/index.php?order=$1 [QSA,L] When you do a /([A-Za-z0-9]*)$ you are looking for alpha numeric 0 to infinite times without a trailing / this is fine but if anyone links to the page with a trailing / it won't get picked up by the mod. ![]() |
|
#23
|
|||
|
|||
|
Hi,
Based on your tutorial, I have modified code for my site. I intend to change from http://www.mydomain.com/cgi-bin/book...sin=0815332181 to http://www.mydomain.com/cgi-bin/book...0815332181.htm my code is as follows: RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} ^asin\=([^&]+)$ RewriteRule ^$ /displayitem/%1.html [R=301,L] this code did not do anything. Please help me out. Thank you, Stefan |
|
#24
|
|||
|
|||
|
You need to change your code to output the static url. Then use a rewrite rule to rewrite static -> dyamic on the server.
http://www.mydomain.com/cgi-bin/book...0815332181.htm -> http://www.mydomain.com/cgi-bin/book...sin=0815332181 Code:
RewriteEngine On RewriteBase / RewriteRule ^cgi-bin/books/displayitem/([^/]+)\.htm$ cgi-bin/books/displayitem.cgi?asin=$1 [L] |
|
#25
|
|||
|
|||
|
might have just answered this but............
Hi,
I appreciate your help on these boards but I am new to this stuff & having some problems. Let me start with the basics: I have successfully used the mod_rewrite by changing: http://www.mysite.com/mydirectory/postlist.php?Cat=0&Board=myfile to http://www.mysite.com/mydirectory/myfile.htm by using the following .htaccess code: RewriteEngine on RewriteBase /mydirectory/ RewriteRule ^myfile\.htm$ postlist.php?Cat=0&Board=myfile [T=application/x-httpd-php] Here is my problem, I have to physically type in the static address to make sure this code works. On my webpage, when I run my mouse pointer over the target link, the dynamic link shows up on the bottom left hand corner of the browser. Furthermore, when I click the link, it still defaults to the old dynamic url. Is there extra code that will make the static URL show up (redirect) in the browser window? Also, is there a way to make the new (static) URL show up on the bottom left hand corner of my browser before it is clicked? Will that even matter to the search engine spiders? If you could please explain all of this very carefully, I would appreciate it. As I stated, I'm new to all of this. |
|
#26
|
|||
|
|||
|
Mod rewrite doesn't rewrite your links. It rewrites urls that your links output back to the dynamic form on the server. see this for more info on mod rewrite's can and cannot's.
So you have to open your page code and change how it outputs your <a href> Once you do that then you make a rewrite rule to rewrite the static to dynamic ![]() |
|
#27
|
|||
|
|||
|
Hello...
interesting thread... I have something to do.. when I maintenance my site I put under construction page something like mydommain.com/index.htm and i want to redirect al traffics come to this site to that page.. something like if some one try to visit mydommain.com/see.php or mydommain.com/stuffs/index.htm or what every the URL they all forward to my Under construction page. Dose anyone can help me please? |
|
#28
|
|||
|
|||
|
Help with fancy URL please
Hi all,
Just found the forums. They are great, I have a lot of reading to do ![]() I currently have this url: http://www.domain/archives/category/ely-history/ But ideally I would like to do this: http://www.domain.com/ely-history/ Can I do this? Many thanks |
|
#29
|
|||
|
|||
|
Can you walk me through this line?
Quote:
$ -- ending /catalog/ -- anything with the letters 'catalog' in that order only %1 -- variable one %2 -- variable two .html -- put period and letters 'html' in that order only And then... I need help. Does the R stand for 'Redirect' and 301 that it is a 301 redirect? What is 'L'? And tell me what the [ ] at the end is called so I can look it up and learn more. (Extension?) Thanks. Last edited by grnidone : 02-06-2006 at 04:04 PM. |
|
#30
|
|||
|
|||
|
[] is a flag holder
R, by default is a 302 redirect R=301, tells the server to issue a 301 header instead of 302 L, mean this is the last rule. F, Forbidden QSA, query string append if there is any query string on the url add it to the rewrite rules output. These are the main ones you'll use I have a list of what all the flags mean here http://www.webforgers.net/mod-rewrit...ite-syntax.php |
|
#31
|
|||
|
|||
|
I need a tip
seomike or anyone else -- here's a tough one I've been struggling with:
One of my categories is music -- you go to the music page and there are a ton of items. I currently have my mod rewrite changing this: www.mysite.com/shop/music to this: www.mysite.com/index.php?category=music so my mod rewrite language is something like: RewriteRule ^shop/music$ index.php?category=music [NC] Easy enough. But on the music category page, I want to have some "sort by" links -- sort all music by price, sort by bestsellers, etc. I was thinking of having the links as follows: www.mysite.com/shop/music?sortby=price www.mysite.com/shop/music?sortby=bestsellers etc etc I'd like it to load a page: http://www.mysite.com/index.php?cate...c&sortby=price http://www.mysite.com/index.php?cate...by=bestsellers So what would the mod rewrite language be? I'm having trouble telling it to "look after the question mark in the requested URI and add the following stuff on to the underlying page". Any way to do this? Incidentally, I'd like to avoid doing this: www.mysite.com/shop/music/price www.mysite.com/shop/music/bestsellers I know how to do this already. Why do I want to avoid this? Because my analytics solution reads each of those as separate pages and I don't want it to do that. Thoughts? Thanks for any help fellas. |
|
#32
|
|||
|
|||
|
Do I have this right ?
The Plan from this: mobiles.php?net=T-Mobile&make=Motorola&model=V3&id=9 to this: /mobiles/T-Mobile/Motorola/V3-9.html Code:
RewriteCond %{QUERY_STRING} ^net\=([^&]+)\&make\=([^&]+)\&model\=([^&]+)\&id\=([^&]+)$
RewriteRule ^$ /mobiles/%1/%2/%3-%4.html [R=301,L]
|
|
#33
|
|||
|
|||
|
here is what I have managed to figure out.
Code:
#start .htaccess code RewriteEngine On RewriteRule ^mobiles/(.*)/(.*)/(.*)-(.*).html$ mobiles.php?net=$1&make=$2&model=$3&id=$4 [L] RewriteRule ^makes/(.*)/index.html$ make.php?make=$1 [L] RewriteRule ^networks/(.*)/index.html$ network.php?net=$1 [L] Code:
RewriteRule ^mobiles/(.*)/(.*)/(.*)-(.*).html$ mobiles.php?net=$1&make=$2&model=$3&id=$4 [L] ^mobiles/ = the name of the script mobiles.php /(.*) = catches the name of the dir so net=motorola will be motorola and then the next /(.*) will pick up make=Orange making orange and /(.*) will pick up model=V3 as V3 and -(.*) will pick up the ID=4 as -4 .html is the file ext so my url can be mobiles/Orange/motorola/V3-4.html and the above rule will translate it into: mobiles.php?net=Orange&make=motorola&model=V3&ID=4 seems to work well have I done it right is there a more efficent way of doing it ? |
|
#34
|
|||
|
|||
|
server rewrites issue
Hi,
In the past we used mod_rewrite to rewrite the urls of all the html pages so they pointed to a php page. Now when google access our server to check the sitemap page they gave us it says we are returning a 200 when we should be returning a 404. I'm not sure if they are testing the Sitemap page only and coming to their conclusion or if they are checking for an actual bogus page on our server and getting a 200 error when they expect a 404. If they are only checking their assigned error then I know a workaround. That is, have the server rewrite check for their page name, and then dont process it in rewrite. If they are checking for a bogus page, than i don't know yet how to resolve this. If this is the case than I would appreciate some suggestions. Thanks, Jeff |
|
#35
|
|||
|
|||
|
I don't think I understand the question fully. Are you having an issue of Google still crawling old versions of the url because the site map still links to it?
or there was an old site map and it's not there anymore but when called the mod rewrite picks it up and sends 200 ok response and you want to kill that? |
|
#36
|
|||
|
|||
|
Quote:
===== We've detected that your 404 (file not found) error page returns a status of 200 (OK) in the header. This configuration presents a security risk for site verification and therefore, we can't verify your site. If your web server is configured to return a status of 200 in the header of 404 pages, and we enabled you to verify your site with this configuration, others would be able to take advantage of this and verify your site as well. This would allow others to see your site statistics. To ensure that no one can take advantage of this configuration to view statistics to sites they don't own, we only verify sites that return a status of 404 in the header of 404 pages. ===== The error message is confusing as I am not sure how they get a 404 error. I am using server rewrites, however when they visit the page that they gave us they send us back that error message. Sorry it doesnt make any sense to me. However I did solve the problem, I disabled the server rewrites long enough to resubmit the site to the google service. They approved it and then I renabled the server rewrite. My bottom line question is, how are they coming to the above conclusion? In my situation what would I be doing for them to conclude the above? Jeff |
|
#37
|
|||
|
|||
|
You got me. lol I've never heard anything like this
![]() |
|
#38
|
|||
|
|||
|
Are you using a custom 404 page?
|
|
#39
|
|||
|
|||
|
Quote:
The fact is when I remove the server rewrites from the htaccess file, they have no problems. Jeff |
|
#40
|
|||
|
|||
|
mod rewrite
I'm new at mod rewrite.
I know how to write a line in the htaccess file to make the link "search friendly" as long as the arguments after the "?" has this format: xxx=something&xxx2=something2, but how is it written when the arguments don't have the "=" sign. They are like this: ?xxx&xxx Thanks for any suggestions. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|