Modelu : simple-blog
I have enable Use SEO URLs (Admin: Settings >> Server >> Use SEO URLs), if you click on blog page in frontend, get error 404.
Url : localhost/opencart/Establishing-Your-Brand-on-College-Campuses
Related
how to do this in sharepoint 2013
if i enter this url https://example.com/abc/sites/home.aspx it should redirect to https://example.com/abc/sites/home/Menu.aspx
You could edit the home page and insert some js code to redirect to the target page.
Check redirect to another page programmatically
BR
I moved a 20 year old classic asp web site to a django app recently. Google Search Console is showing 500 errors for tons of very old URLS with parameters like /somefile.asp?ID=1234&name=some-name. Most of these URLS I don't even care about - they are really old but would rather they result in 404 than 500. Some do relate to newer content and in theory I could redirect to new django pages but when I try to redirect them using the django redirect app, the site shows 500 errors - like the ? either stops the pages from ever getting to the redirect middleware or the redirect app doesn't like the "?". How can I redirect these urls so I don't get 500 errors? Is there a way in a view to say:
if the full url path is x
redirect to full url path y
I have looked all over stack overflow and elsewhere and can't find this exact problem or a way to write a view like this. I did try the solution here (exactly) because it seems closest to my issue, but it did not work for me for this exact problem: Django's redirects app doesn't work with URL parameters
An example would be /profiles/?adid=134&v=857
The error with debug true is:
DoesNotExist at /profiles/
BusinessCategory matching query does not exist....
So it is trying to match this URL:
path('<slug:slug>/', views.view_category_list, name='view_category_list'),
before it ever gets to the /?
Relevant view code:
def view_category_list(request, slug):
try:
category_detail = BusinessCategory.objects.get(slug=slug)
except BusinessCategory.DoesNotExist:
category_detail = None
if category_detail:
--code here is all working fine so removed it to get to the issue--
else:
raise Http404
I hoped raising the 404 would call up the redirect app to do its job at redirecting to a specific url but it doesn't - it just shows the custom 404 when debug is False. Anyway, the 404 is better than the 500 for SEO purposes but I still would prefer being able to actually redirect some of the URLs to relevant content.
I am getting a lot of search engine referral links for my previous PHP developed site that has now been migrated over to Django. I made a url redirect for the old php links like search.php?name=john+smith to the same view for my django search url as shown here:
urls.py
url(r'^search.php/$', profile_search, name='search'),
url(r'^search/$', profile_search, name='search'),
Will Google eventually update those old links if I redirect through urls.py or do I need to make a 301 redirect? If so how would I do this with django and nginx?
I would do this at nginx level - this is much more efficient than having Django handle it. Assuming the Django view expects the same query arguments, you can do this in your nginx server block:
location = /search.php {
return 301 http://$server_name/search/$is_args$args;
}
This will redirect all requests for search.php to /search/, preserving any query arguments.
A 301 response is definitely the correct approach - you don't want to serve duplicate content on different URLs.
Unless you have HttpResponseRedirect in your profile_search method, you don't actually have any sort of redirect here at. But what you really want to use is HttpResponsePermanentRedirect
def profile_search(request):
return HttpResponsePermanentRedirect('/somether/url/?based_on_request_params')
I am following the Tutorial and everything else works fine. The only problem is that when I try to login using the Rest Framework browsable API, I get a 404 after the login:
Request URL: http://localhost:7000/accounts/profile/
Using the URLconf defined in shelter.urls, Django tried these URL patterns, in this order:
^times/
^admin/
^api-auth/
The current URL, accounts/profile/, didn't match any of these.
Times is the name of the app. The API login is redirecting to accounts/profile, I haven't set that url up so of course the response is a 404. I'm probably missing a simple and obvious step.
I am using django social auth in my app and I found a Page not found error.
I have installed it in my app and also place it in my project parallel to my app.
And I have also add url to my url file
url(r'', include('social_auth.urls')),
But when it shows me the error It shows the list of url in my url file and where i have the required url which i am looking for.
The error page is as :
Page not found (404)
Request Method: GET
Request URL: http://abc.com/login/
Using the URLconf defined in webdev.urls, Django tried these URL patterns, in this order:
^$ [name='home']
^polls/
^admin/doc/
^admin/
^register1/
^edit/
^edit1/
^customerreg/
^checkout/
^checkout1/
^order/
^order1/
^upload/
^upload1/
^product/
^profile/
^logout/
^login/(?P<backend>[^/]+)/$ [name='socialauth_begin']
^complete/(?P<backend>[^/]+)/$ [name='socialauth_complete']
^associate/(?P<backend>[^/]+)/$ [name='socialauth_associate_begin']
^associate/complete/(?P<backend>[^/]+)/$ [name='socialauth_associate_complete']
^disconnect/(?P<backend>[^/]+)/$ [name='socialauth_disconnect']
^disconnect/(?P<backend>[^/]+)/(?P<association_id>[^/]+)/$ [name='socialauth_disconnect_individual']
The current URL, login/, didn't match any of these.
In the above list you can see that url file have that url , but it doesn't access that ??
^login/(?P<backend>[^/]+)/$ [name='socialauth_begin']
This url do not match with http://abc.com/login/ as the url pattern requires a backend parameter.
Something like this will match the url you are accessing, however there is no backend parameter there, so in view you may want to choose something default.
url(r'^login/$', 'your_view',),