I want my site work as:
example.com/$key router to:example.com/home/search/$key`
and
example.com/search/$key router to:example.com/home/search/$key`
What do I do? Please help me.
Ps:home is controller, search is method of home
I use my version 2. of codeigniter
$key is variable
Related
I want to make a main URL and that URL will be the main route for all my Django apps.
Suppose I have 3 apps: blog, linux and business. I want to make URLs like this:
127.0.0.1:8000/blog/ (when i will click blog menu)
127.0.0.1:8000/blog/linux ( when i will click linux menu)
127.0.0.1:8000/blog/business (when i will click business menu)
The blog app will be my index home page and all the apps' links will be like this. I don't want to import all of the views and models in the blog app. The project's structure will be the same and I don't want to change it.
All I want is to make blog common for all the apps. If I click a post on a linux page, the URL will be like this:
127.0.0.1:8000/blog/linux/post name
How can I do this?
This is my project's structure:
[]
You can write all the URLs into the urls.py in your project folder or you can make a urls.py in your apps folder. Maybe read this
After Creating the App in django project by following procedure in https://docs.djangoproject.com/en/3.0/intro/tutorial01/
App Folder (blog app folder, found inside project folder)
Add these urls
127.0.0.1:8000/blog/linux
127.0.0.1:8000/blog/business
to the app/urls.py file above the admin.site url path
Project Folder:
Configure the urls.py file in the project folder by adding the 127.0.0.1:8000/blog/ url above the admin.site url path. This configuration is done to load this url when the server starts running.
The django checks for the requested url pattern and will route the first discovered url.
The django cannot identify duplicate url.
In next.js that uses php-like approach - files in pages folder became url paths. Like /pages/reader.js will be loaded by url http://localhost/reader.
Problem is that i can't undersand how to use non-english url path in next.js?
Codesandbox example. (Update page to load from server)
Url example:
http://localhost/читатель
That changes internally by chrome to:
http://localhost/%D1%87%D0%B8%D1%82%D0%B0%D1%82%D0%B5%D0%BB%D1%8C
In next.js pages folder file named:
pages/читатель.tsx // not working
pages/%D1%87%D0%B8%D1%82%D0%B0%D1%82%D0%B5%D0%BB%D1%8C.tsx //working but i can't name files like that, i will not find what i need later.
Maybe php users resolved this somehow ;)
try to use encodeURI() of core javascript which can convert the specific characters to the required url form
const url=encodeURI('читатель.tsx');
console.log(url);//%D1%87%D0%B8%D1%82%D0%B0%D1%82%D0%B5%D0%BB%D1%8C.tsx
Then we can use this path to navigate
My issue is, the value passed is received alright in blade in my local server. But in my remote server, blade file cannot access the value set in controller. Why that might be?Can somebody help please?
In HomeController
public function getDetails(Request $request) {
echo $url = $request->input('url');
return view('home.details')->with('url', $url);
}
Here, no value is echoed.
Looks Like the real problem is, in remote server I am not being able to read url params for some reason.
Any sugestion please?
Can't read url params in php laravel
This url has my answer! The problem seems with the .htaccess file. The confusion is, why it works in my local server then?
I used the .htaccess described in following link
https://github.com/laravel/laravel/blob/master/public/.htaccess
Just I added
RewriteRule ^(.*)(images|css|js|fonts|upload|plugins|img|ckeditor)(.+)$ public/$2$3 [L]
the line above because of my apps folder arrangements. So far it's working fine now.
Though the question is answered, I will appreciate if somebody could explain why the same .htaccess that works in my local doesn't in my remote?
The default app url looks like http://[app prefix]-[app id].[domain name]/[site collection path]/[app path]/pages/default.aspx.
It is unconvinient because every deployment during development generates new url. And after development stage the end users need a permanent link to the application, but every bug fixes or updates that will be deployed will cause new app url generation. Is there right way to fix the app url?
You can create a URL controller:
Create a list that would contain two fields: fakeUrl, realUrl,
fakeUrl can be something like "http://staticappname.[domain name]/[site collection path]/[app path]/pages/default.aspx"
realUrl would be your http://[app prefix]-[app id].[domain name]/[site collection path]/[app path]/pages/default.aspx
Give your users fakeUrl
Create a HTTPModule that would read the list and redirect the http request to the realUrl
After you redeploy your app, just change the realUrl in the list
***I'm not if this is your case but you could change your app to be a provider-hosted. Then you would get a static Url
You can open your SharePoint hosted add-in using an alternate link like:
http://[SharePointSite]/[Add-inName]
For eg.
http://contoso.com/sharepointhostedapp/
My URLs aren't resolving correctly.
When I deploy my app name is omitted from the urls.
Its suppose to be:
http:////Content/images/ect
But it gets rendered as
http:///Content/images/ect
which obviously doesn't resolve.
My URLS looks like this:
<img src="/Content/images/Misc/Lock.png" />
If I add a ~ to the url (before content) it resolves perfectly when deployed, but breaks in my dev environment.
This being a MVC app means I also have a few ajax calls to actions (controller/action/) which also does not resolve, breaking most of the site.
I deployed under the default web site in IIS, moving it to another site is not an option.
Any advice will be greatly appreciated.
Have you tried using Url.Content?
It would be something like this (untested)
<img src="#Url.Content("~/Content/images/Misc/Lock.png")" />
This has to do with your host, if you are running this site as a sub site and not under its own IIS site, the host requires the ~. I have gotten around this by using a global javascript variable to hold the site root. I populate the variable in the main site layout like so:
var gSiteRoot = '#MvcHtmlString.Create(Url.Content("~/"))';
Then when I need to construct a url in js I use it like so:
var url = gSiteRoot + 'restofurl';