API Reference - Redirects
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108112
← Back to API Reference | Getting Started
Redirects
Redirects define 301 permanent redirect rules on your directory site. Each record maps an old URL path to a new destination URL, enabling you to manage URL changes after content moves, slug updates, or site restructuring without breaking inbound links.
Model name in URL:
redirect_301 — DB table: 301_redirectsThe Redirect Object
| Field | Type | Description |
|---|---|---|
redirect_id | integer | Unique redirect ID (primary key, read-only) |
id | integer | Legacy secondary identifier; typically 0 for system-generated redirects |
type | string | Category of the redirect source (EG profile, post, category, custom) required on create |
old_filename | string | The old URL path being redirected from, relative to the domain root (EG old-slug/member-name) required on create |
new_filename | string | The new destination URL path to redirect to (EG new-category/new-member-name) required on create |
date_added | string | Timestamp when this redirect was created (format: YYYYMMDDHHMMSS) |
db_id | integer | Database record ID of the source content object (EG user ID, post ID) this redirect was generated from |
updated_by | string | Username or system identifier that created or last updated this redirect |
List Redirects
GET /api/v2/redirect_301/get
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/redirect_301/get?limit=25" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"redirect_id": "7",
"id": "0",
"type": "profile",
"old_filename": "united-states/los-angeles/top-level-category/sample-member",
"new_filename": "neurofeedback/portugal/lisbon/alges/active-life/sample-member-iii",
"date_added": "20210301062133",
"db_id": "1",
"updated_by": ""
},
{
"redirect_id": "8",
"id": "0",
"type": "custom",
"old_filename": "old-page-slug",
"new_filename": "new-page-slug",
"date_added": "20230615094500",
"db_id": "0",
"updated_by": "admin"
}
],
"total": "24",
"current_page": 1,
"total_pages": 1
}Retrieve a Redirect
GET /api/v2/redirect_301/get/{redirect_id}
Example Request
Copy
curl -X GET "https://www.yourdomain.com/api/v2/redirect_301/get/7" \ -H "X-Api-Key: your-api-key-here"
Example Response
Copy
{
"status": "success",
"message": [
{
"redirect_id": "7",
"id": "0",
"type": "profile",
"old_filename": "united-states/los-angeles/top-level-category/sample-member",
"new_filename": "neurofeedback/portugal/lisbon/alges/active-life/sample-member-iii",
"date_added": "20210301062133",
"db_id": "1",
"updated_by": ""
}
],
"total": "1",
"current_page": 1,
"total_pages": 1
}Create a Redirect
POST /api/v2/redirect_301/create
Example Request
Copy
curl -X POST "https://www.yourdomain.com/api/v2/redirect_301/create" \ -H "X-Api-Key: your-api-key-here" \ -d "type=custom" \ -d "old_filename=old-about-page" \ -d "new_filename=about-our-company" \ -d "updated_by=api"
Example Response
Copy
{
"status": "success",
"message": {
"redirect_id": "25",
"id": null,
"type": "custom",
"old_filename": "old-about-page",
"new_filename": "about-our-company",
"date_added": null,
"db_id": null,
"updated_by": "api"
}
}Update a Redirect
PUT /api/v2/redirect_301/update
Example Request
Copy
curl -X PUT "https://www.yourdomain.com/api/v2/redirect_301/update" \ -H "X-Api-Key: your-api-key-here" \ -d "redirect_id=25" \ -d "new_filename=about-us"
Example Response
Copy
{
"status": "success",
"message": {
"redirect_id": "25",
"id": null,
"type": "custom",
"old_filename": "old-about-page",
"new_filename": "about-us",
"date_added": null,
"db_id": null,
"updated_by": "api"
}
}Delete a Redirect
DELETE /api/v2/redirect_301/delete
Example Request
Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/redirect_301/delete" \ -H "X-Api-Key: your-api-key-here" \ -d "redirect_id=25"
Example Response
Copy
{
"status": "success",
"message": "redirect_301 record was deleted"
}