I am trying to perform a POC for the company I work to see the potential value we can get by using DocC in our project.
Before my development, I saw the 4 videos related to DocC from WWDC 2021, visit Apple developer site and read some pages and blogs to gather some information and thoughts.
For my development, I started using MAMP on my dev machine before pushing the work to the server.
So far, I think I have done all the necessary steps to host the doccarchive on the website. However, I wonder if I have missed something as my index.html looks blank.
The code I used is:
index.html (main)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DocC POC</title>
</head>
<body>
<h2>Welcome</h2>
<button onclick="location.href = 'documentation/index.html';" id="myButton" class="float-left submit-button" >Read data framwework documentation</button>
</body>
</html>
.htaccess
# Enable custom routing.
RewriteEngine On
# Route documentation and tutorial pages.
RewriteRule ^(documentation|tutorials)\/.*$ Data.doccarchive/index.html [L]
# Route files and data for the documentation archive.
#
# If the file path doesn't exist in the website's root ...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# ... route the request to that file path with the documentation archive.
RewriteRule .* Data.doccarchive/$0 [L]
File structure
Picture prooving that the doccarchive is not empty
Picture of blank page
Any ideas??
I was able to try it on github pages and was showing blank until I used the path {base path}/documentation/{project name}
so in your case try to replace index.html with your project name
Related
I was trying to add some styling in my localhost(wamp) lavarel project....
This is my style.css file located in public folder
p{font-weight:bold; size:20px; color:red;}
This is hello.blade.php file located in app/view folder
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="{{ URL::asset('style.css') }}">
</head>
<body>
<p>Test</p>
</body>
</html>
& My routes.php file is having following code:
Route::get('/',function(){
return View::make('hello');
});
.htaccess file located in root directory is
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
When I am trying to access that hello page by localhost, Test content is visible without any styling. Can anyone tell me what is going wrong with me??
Your directory structure is different from the default one shown here
You have to put the packages folder and these files into the public directory:
.htaccess
favicon.ico
index.php
robots.txt
Then to make your site work again change the document root of your apache server to path/to/application/public
There's a reason for the public directory. When you put it on a server on the internet you gain additional security because the user can only access what is in the public directory. (because the domain is pointing to this folder) If you use your current setup everybody could see your whole application. For example one could enter example.com/app/config/database.php and would see your database password.
Put it like this:
<link rel="stylesheet" href="{{ asset('style.css') }}">
Without URL::
Where should static javascript and css files in a Laravel 4 application. For the sake of my own understanding, I'm not interested in using any sort of assets or packages yet.
I tried putting them under public/js and public/packages to no avail, getting the following 404 errors in my page:
GET http://localhost/~myuser/mytest/packages/test2.js 404 (Not Found)
GET http://localhost/~myuser/mytest/js/mytest.js 404 (Not Found)
Here is what my .htaccess file looks like for reference:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /~myuser/mytest/public/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
All assets should be placed in the public folder
public/js
public/css
public/fonts
public/images
You can access the assets using the asset() method or the Laravel HTML helper methods HTML::script and HTML::style.
i.e to include Javascript file:
- <script src="{{ asset('js/yourfile.js') }}"></script>
- {{ HTML::script('js/yourfile.js') }}
Hope this helps!
Inside the laravel folder you got public folder put css and js files here and access like this
<!doctype html>
<html lang="en">
<head>
<title>{{$title}}</title>
{{HTML::style('css/style.css')}}
</head>
<body>
#include('layouts.nav')
#yield('content')
</body>
</html>
We have a desktop and a mobile version of our webapp.
The desktop url is more prominent and so we would like to redirect the user to the mobile version in case the request is for the desktop url from a mobile device.
In the apache config we have the mod_rewrite module
and my config at present looks like this
<IfModule mod_rewrite>
RewriteEngine On
RewriteCond %{x-wap-profile} ^https?://
RewriteRule ^/(.*) http://google.com [L,R]
</IfModule>
At this point this is the only rewrite rule that we have so I'm not sure if L is required because this is the first and last rule anyway.
I have just indicated redirection to google.com for testing purposes
I'm not sure if my condition check is right.I couldn't figure out how to check for existence of a header.Is that what is wrong?If yes,please let me know how to specify the RewriteCond
How I'm Testing?
I'm testing from a Firefox browser and using the Modify headers plugin to simulate the mobile request.I'm adding the x_wap_profile header.
However I don't see any redirect happening with this config.Can you please let me know where I'm going wrong?I would also appreciate if there is any logging that can be introduced here to verify if this rule is being trigerred.I don't see any errors though with the current modified config.
To check for an arbitrary header in mod_rewrite (i.e. a header not in this list), the syntax is:
RewriteCond %{HTTP:x-wap-profile}
This one seems to work:
RewriteEngine On
RewriteCond %{HTTP:x-wap-profile} ^.+
RewriteRule .* http://google.com [L,R]
piotrek#piotrek-Vostro-2520:~/vhosts/localhost$ curl http://localhost/
OKOK
piotrek#piotrek-Vostro-2520:~/vhosts/localhost$ curl -H 'x-wap-profile: abcd' http://localhost/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved here.</p>
<hr>
<address>Apache/2.4.6 (Ubuntu) Server at localhost Port 80</address>
</body></html>
Change it to make it work for https inside header.
Docs here: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond in section Other things you should be aware of:.
I have
<link href="/smarter-computing/us/en/sc-mobile.css" type="text/css"/>
<script src="/smarter-computing/js/sc-common.js?fileversion-r21" type="text/javascript">//</script>
When I am working on these files locally I have to keep append //localhost/~vc/ before the path for JS and CSS files. I don't want to keep copy/pasting this path for the following and every <img> links in my code.
How can I use htaccess to redirect all url's pointing to //localhost/smarter-computing/ or /smarter-computing/ to append this path //localhost/~vc/ before my /smarter-computing path.
Thank you,
Vishwas
You can either make the document root your home directory in your apache config in localhost, or add this to the header of your pages:
<base href="/~vc/">
This question already exists:
Closed 11 years ago.
Possible Duplicate:
Css and javascript Not Loading in rewrite rule
After using only rewrite rule
RewriteEngine On
RewriteRule ^profile.php$ profile.php
and when i load profile.php the css and javascript are loading
but when make a change in rule and add condition
RewriteEngine On
RewriteCond %{REQUEST_URI} !/profile.php$
RewriteRule ^profile.php$ profile.php
and then the js and css are not loading
Coding of profile.php is
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-…
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" href="http://localhost/css/profile.css" />
</head>
<body>
<table><tr><td><div class="image"><ul><li>My</li></ul></div>
</td></tr></table>
</body></html>
it's because the RewriteCond says : apply the followingRewriteRuleonly if the url doesn't only contain /profiles
you should write it like :
RewriteCond %{REQUEST_URI} /profile.php$
(without the exclamation mark)
in add:
If you don't want your mod_rewrite Rules to be apply on scripts and other specific files request, you should write a Rule for them.
E.g.
RewriteRule \.(css|jpe?g|gif|png)$ - [L]