A powerful PHP script that automatically generates SEO-friendly sitemap.xml and robots.txt files by scanning your website's directory structure. Features an intuitive admin interface for customizing which pages to include or exclude.
- Recursively scans your
public_html
folder - Automatically excludes common non-web files (php, txt, images, etc.)
- Creates organized tree structure of files and directories
- User-friendly checkboxes for each file and directory
- Granular control with include/exclude options
- Convenient Select All/Deselect All functionality
- Session-based settings persistence
- Standards-compliant XML sitemap creation
- Automatic
lastmod
dates based on file modifications - Intelligent priority assignments:
- Homepage: 1.0
- Other pages: 0.8
- URL encoding for spaces and special characters
- Automatic robots.txt file creation
- Includes sitemap location reference
- Configurable Disallow rules for excluded paths
- Default Allow rules for included content
- Search engine optimized XML formatting
- Smart priority weighting system
- Fresh content indicators with last modified dates
- Homepage prioritization
- Proper URL encoding for all entries
- Create a new file (e.g.,
sitemap-admin.php
) and paste the script code - Set up authentication:
- Change the password from admin to something you like
- Access the admin interface through your browser
- Select/deselect files and folders as needed
- Click "Generate Sitemap & robots.txt"
- Create a Google Search Console account
- Add and verify your website ownership
- Submit your sitemap URL:
yourdomain.com/sitemap.xml
Add these meta tags to your static homepage:
<meta name="description" content="Your site description">
<meta name="keywords" content="relevant, keywords, here">
<meta name="robots" content="index, follow">
Consider implementing these additional SEO enhancements:
- Schema.org markup for rich search results
- Canonical URLs for duplicate content management
- XML sitemap index for large-scale websites
- Mobile-responsive design optimization
- Ensure proper file permissions for writing sitemap.xml and robots.txt
- Regularly update your sitemap as your content changes
- Monitor Google Search Console for crawl errors
- Test your sitemap validity using online tools
- Always implement proper authentication for the admin interface
- Restrict access to sensitive directories
- Regularly update your PHP version
- Monitor access logs for suspicious activity
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.