开发者

Help to rightly create robots.txt

开发者 https://www.devze.com 2023-01-16 06:52 出处:网络
I have dynamic urls like this. mydomain.com/?pg=login mydomain.com/?pg=reguser mydomain.com/?pg=aboutus mydomain.com/?pg=termsofuse

I have dynamic urls like this.

mydomain.com/?pg=login

mydomain.com/?pg=reguser

mydomain.com/?pg=aboutus

mydomain.com/?pg=termsofuse

When the page is requested for ex. mydomainname.com/?pg=login index.php include login.php file.

some of the urls are converted to static url like mydomain.com/aboutus.html mydomain.com/termsofuse.html

I need to allow index mydomainname.com/aboutus.html, mydomainname.com/termsofuse.html and disallow mydomainname.com/?pg=login, mydomainname.com/?pg=reguser, please help to manage my robots.txt file.

I have also mydomainname.com/posted.php?deta开发者_StackOverflow社区ils=50 (details can have any number) which I converted to mydomainname.com/details/50.html I need also to allow all this type of urls.


If you wish to only index your static pages, you can use this:

Disallow: /*?

This will disallow all URLs which contain a question mark.

If you wish to keep indexing posted.php?details=50 URLs, and you have a finite set of params you wish to disallow, you can create a disallow entry for each, like this:

Disallow: /?pg=login

Or just prevent everything starting with /?

Disallow: /?*

You can use a tool like this to test a sampling of URLs to see if it will match them or not.

http://tools.seobook.com/robots-txt/analyzer/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号